Results 1 to 1 of 1
May 17, 2012, 14:08 #1
- Join Date
- Feb 2005
- Burlington, Canada
- 89 Post(s)
- 6 Thread(s)
How to configure a front-end apache server and save valuable I.P.s
Many of you may already know how to do this, however for those that are stuck with the need to redirect website through one I.P. that then need to route to unique servers or VM's on your internal network that each have their own private I.P. here is one way to do this.
We will use an example of three different servers, FrontEnd, BackEndA, BackEndB
Nothing special has to be configured in the FrontEnd apache2.conf or httpd.conf.
I choose to put a virtual_web_router file in 'sites-enabled' and in this file I have a pretty simple configuration:
<VirtualHost *:80> ServerName *.siteone.ca ServerAlias *.siteone.ca ProxyPreserveHost On ProxyPass / http://172.16.1.181/ #This is for BackEndA ProxyPassReverse / http://172.16.1.181/ <Proxy http://172.16.1.181> Allow from 172.16.1.181 </Proxy> </VirtualHost> <VirtualHost *:80> ServerName www.sitetwo.com ServerAlias sitetwo.com ProxyPreserveHost On ProxyPass / http://172.16.0.110/ #This is for BackEndB ProxyPassReverse / http://172.16.0.110/ <Proxy http://172.16.0.110> Allow from 172.16.0.110 </Proxy> </VirtualHost>
#siteone.com <VirtualHost *:80> DocumentRoot /var/www/siteone ServerName www.siteone.com ServerAlias siteone.com <Directory "/var/www/siteone"> allow from all Options +Indexes </Directory> </VirtualHost>
#sitetwo.com <VirtualHost *:80> DocumentRoot /var/www/sitetwo ServerName www.sitetwo.com ServerAlias sitetwo.com <Directory "/var/www/sitetwo"> allow from all Options +Indexes </Directory> </VirtualHost>
This will work through a Firewall NAT too.
Please be aware that I did not include security considerations in this mini-how-to so you need to be vigiliant in hardening both front and back end servers.
Hope this helps.