Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A server on my local network is running Apache2 that hosts a site accessible from the Internet. I can access that site from outside the network just fine, but not from inside it.

That is, I can't access the web site when my Internet connection is provided by the same router that provides Internet access to the web server.

I get the idea this is because the router does not allow two connection on port 80 at the same time, but I could be wrong. Any thoughts?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The problem is that your router (a home or SoHo one I presume) will not port forward on the internal interface.

What is happening goes along these lines:

  1. PC on your LAN does a DNS lookup for your website and gets your Router's public IP address
  2. Web browser sends its requests on port 80 to your public IP address
  3. Your router gets the request on its internal interface and since it has no port forwarding capability on this interface it either sends it to its own web site or just drops it rather than forwarding it to your webserver.

To get around it you will have to use the local IP address of your webserver - you should put this in your Hosts file so that you can still access it using its URL rather than IP address to allow virtual hosts to work.

For example add the line www.mygreatwebsite.com 192.168.1.10 to your hosts file (naturally inserting your actual details) and use www.mygre... rather than the IP address so that when your browser's HTTP request hits Apache it gets the URL so virtual hosts can work.

share|improve this answer
    
The server is using virtual hosts, so the local IP address just displays Apache's "It Works" page. Do you think it would work if I could set it up to forward connections on the internal interface to the web server? I don't need to access the setup page for the router since it's managed by the ISP and I don't have access to it anyway. –  fluffels Feb 9 '10 at 11:28
    
Either set it as the default website in Apache or add its IP address to your hosts file so that your browser still sends the URL in its headers - have edited my answer to reflect this –  Jon Rhoades Feb 9 '10 at 11:54
    
I'll give this a shot. Thanks! –  fluffels Feb 9 '10 at 15:20

It sounds as though the apache web server is not listning for connections on your internal IP address.

If you have a look in your httpd.conf there should be a line called listen with an ip address and port. If you want additional listens just make a new line and enter something like

Listen 192.170.2.5:8000 

Also do you have a firewall installed that might be causing the problem?

share|improve this answer
    
I don't think it's that. When I access the local address I get Apache's default page. This server is using virtual hosts, which is why I don't get the proper web site. There's no firewall installed on the server, but there's one on the router. –  fluffels Feb 9 '10 at 11:25
    
the firewall should not affect your connection to your server internally. sadly my knowlege of apache is limited but i would hazard a guess that there is something amiss in your config file which is causing the problem –  Ben Gillam Feb 9 '10 at 11:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.