httpd.conf configuration - for internal/external access

Posted by tom smith on Server Fault See other posts from Server Fault or by tom smith
Published on 2010-03-14T21:34:42Z Indexed on 2010/03/16 5:06 UTC
Read the original article Hit count: 572

Filed under:
|

hey.

after a lot of trail/error/research, i've decided to post here in the hopes that i can get clarification on what i've screwed up...

i've got a situation where i have multiple servers behind a router/firewall. i want to be able to access the sites i have from an internal and external url/address, and get the same site.

i have to use portforwarding on the router, so i need to be able to use proxyreverse to redirect the user to the approriate server, running the apache/web app...

my setup

the external urls
 joomla.gotdns.com
 forge.gotdns.com

both of these point to my router's external ip address (67.168.2.2) (not really)

the router forwards port 80 to my server lserver6 192.168.1.56

 lserver6 - 192.168.1.56
 lserver9 - 192.168.1.59

 lserver6 - joomla app
 lserver9 - forge app

i want to be able to have the httpd process (httpd.conf) configured on lserver6 to be able to allow external users accessing the system (foo.gotdns.com) be able to access the joomla app on lserver6

and the same for the forge app running on lserver9

at the same time, i would also like to be able to access the apps from the internal servers, so i'd need to be able to somehow configure the vhost setup/proxyreverse setup to handle the internal access...

i've tried setting up multiple vhosts with no luck.. i've looked at the different examples online.. so there must be something subtle that i'm missing...

the section of my httpd.conf file that deals with the vhost is below...

if there's something else that's needed, let me know and i can post it as well..

thanks

-tom

##joomla - file /etc/httpd/conf.d/joomla.conf
Alias /joomla /var/www/html/joomla
<Directory /var/www/html/joomla>
</Directory>

# Use name-based virtual hosting.

#NameVirtualHost *:80
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#<VirtualHost *:80>
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

NameVirtualHost 192.168.1.56:80
<VirtualHost 192.168.1.56:80>
#ServerAdmin [email protected]
#DocumentRoot /var/www/html
#ServerName lserver6.tmesa.com     
#ServerName fforge.tmesa.com
ServerName fforge.gotdns.com:80
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
#ProxyRequests Off

ProxyPass / http://192.168.1.81:80/
ProxyPassReverse / http://192.168.1.81:80/

</VirtualHost>

<VirtualHost 192.168.1.56:80>
#ServerAdmin [email protected]
DocumentRoot /var/www/html/joomla
#ServerName lserver6.tmesa.com
#ServerName fforge.tmesa.com
ServerName 192.168.1.56:80
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
#ProxyRequests Off
</VirtualHost>

© Server Fault or respective owner

Related posts about httpd.conf

Related posts about reverse-proxy