Apache Virtual Hosts behind Cisco Router

Posted by Theo on Server Fault See other posts from Server Fault or by Theo
Published on 2012-12-07T19:07:52Z Indexed on 2012/12/07 23:11 UTC
Read the original article Hit count: 217

Filed under:
|
|
|
|

I'm setting up an Apache 2.2 Ubuntu web server for internal services that is also supposed to be accessed from outside our LAN. Our LAN has a single external IP that is the external IP of our RV042 Cisco router.

We have set up several A records on our external DNS server that point to this IP.

Our internal DNS server resolve the same records to the internal IP of our web server, so computers from inside the network can access them using the same address as if they were outside.

We forwarded the router's external 80 port to our web server's 80 port.

I have set up one Virtual Host for each domain name in our list, and my httpd.conf is something like this:

ServerName web.domain.com
NameVirtualHost *:80

<VirtualHost *:80>
     ServerName alfresco.domain.com
     <Proxy *>
       Order deny,allow
           Allow from all  
     </Proxy>

     ProxyPass /alfresco http://localhost:8080/alfresco
     ProxyPassReverse /alfresco http://localhost:8080/alfresco

     ProxyPass /share http://localhost:8080/share
     ProxyPassReverse /share http://localhost:8080/share
</VirtualHost>

<VirtualHost *:80>
     ServerName crm.domain.com
     DocumentRoot /var/www/sugarcrm
</VirtualHost>

Now, this works if we are in our LAN.

However, if we are outside of our LAN we reach our web server's default page saying:

It Works! This is the default web page for this server. 

But we can't reach the virtual hosts, as if the domain name is not being preserved when the router forward the packets to the web server.

Am I doing something wrong? How can I check what is going on? What should be the settings to make this work from outside?

© Server Fault or respective owner

Related posts about linux

Related posts about apache2