0

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?

5
  • Either one of the domains work outsite (crm or alfresco)?
    – h0tw1r3
    Dec 7, 2012 at 20:13
  • Both domains let me reach my server, however none of them "triggers" Apache's Virtual Hosts. I only get to the default Apache website.
    – Theo
    Dec 7, 2012 at 21:42
  • What's the output from apachectl -S? Could you capture a request from the load balancer with tcpdump to see what exactly it's sending? Dec 8, 2012 at 1:07
  • Did you trying putting the local LAN IP of the web server in the NameVirtualHost section?
    – Daniel t.
    Dec 8, 2012 at 1:25
  • @ShaneMadden This is the output: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server alfresco.domain.com (/etc/apache2/httpd.conf:4) port 80 namevhost alfresco.domain.com (/etc/apache2/httpd.conf:4) port 80 namevhost crm.domain.com(/etc/apache2/httpd.conf:34) Syntax OK
    – Theo
    Dec 13, 2012 at 0:03

1 Answer 1

1

Try putting ProxyPreserveHost On and replacing port 80 with *.

Something like this:

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

     ProxyPreserveHost On
     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>
2
  • ProxyPreserveHost did it for me. I have no IDEA why! As I understand this, the host is preserved for the side that is being reached through the proxy! Anyways, thanks for whatever that was! =)
    – Theo
    Dec 13, 2012 at 0:59
  • Glad it helped :)
    – Napster_X
    Dec 13, 2012 at 6:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .