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.

I've installed Apache server on my machine. I've set it up and designated the root folder, etc. When I go to http://localhost/, it works fine, telling me that Apache is installed correctly. However, when I enter my IP in the browser, it does not work and comes up with "connection timing out" error. I tried configuring everything with my router (i.e. port forwarding), but to no avail. When I connected my computer directly to my modem, bypassing the router, I can access the root folder by typing my IP in a browser. However, the root folder is not accessible through the internet according to http://downforeveryoneorjustme.com/ and a friend who tried to access it through the internet. I've tried specifying my server and binding Apache to my IP address using ServerName and Listen, respectively, in the httpd.conf file. Still, no avail.

Any thoughts? Thanks in advance.

share|improve this question

6 Answers 6

up vote 1 down vote accepted

Guys, I'm stupid. It was my computer's firewall. I had thought that I had allowed port 80, so I dismissed it. Plus, the problems that I had really pointed to another source. But alas, after turning off the firewall, it worked, and then I realized that I had not, in fact, allowed port 80.

Many thanks for the responses.

share|improve this answer

I was going to suggest checking your firewall rules via iptables, but the fact that you can hit your site when you're connected directly to the net (ie: bypassing the router), tells me the issue is with the router and not your server. Was your friend able to access the site via IP when you were connected directly to the net? If they could, then your port forwarding rules on the router is the likely culprit. If they were not, then check to see if iptables is causing the issue by running:

# iptables -L -n | grep 80

You'll need to do this as root.

share|improve this answer
    
The "grep 80" is unnecessary here and may provide false results. What if it returns "-p tcp --dport 80 -j ACCEPT" but grep has filtered out a rule above it that drops -p tcp --source whatever -j DROP? Rules which affect HTTP may not specify port 80. –  James Lawrie Aug 29 '10 at 1:25

Please provide more information, what is your OS ?

First thing you must verify is your apache configuration file, httpd.conf.

If you have it binded to localhost aka 127.0.0.1 or if u have it binded to all ips available within your computer.

To do that, check for Listen and VirtualHost directives in your httpd.conf file.

If they are like this:

Listen 127.0.0.1:80

or

<VirtualHost 127.0.0.1:80>

they are binded to your localhost ip so using your ip won't work.


If that is not the case, very if your firewall, you would probably want to disable your firewall for a few seconds or minutes and try to access it during this period to nail down if your firewall was blocking it or not.


After you have checked the above if you can access from your computer using the IP but people from another connection cannot, it could mean that your ISP blocks the usage of low ports 1-1024 to prevent their clients to make servers within their connection.

share|improve this answer

In a similar vein, check which IP addresses Apache has actually bound to with the following command:

netstat -an | grep :80 | grep LISTEN

If the result is :80 or :::, then Apache is listening on all IP addresses associated with your server. Otherwise, Apache is bound to only one IP address.

If you are going to bind to just one address, it should be the Ethernet interface connected to your LAN. You should configure Apache to listen on the the non routable private IP used by your server behind the NAT based router, not the public IP assigned by your ISP.

On your NAT based router configure port 80 to forward to port 80 on the private IP assigned to your Apache server.

As another answer suggested, double check that iptables isn't blocking the incoming traffic.

Hope this helps.

share|improve this answer

When you were able to "access the root folder by typing my IP in a browser", was this from inside your local network? (Assuming so.)

I suspect your ISP does not allow external access to customer networks on incoming port 80. You could verify this theory (if your router allows it) by setting its port forwarding to direct traffic on Your_External_IP:8888 to Your_Computer's_Internal_IP:80.

Assuming you have Apache set up to listen to port 80 (should be by default) and your computer's firewall configured to pass traffic in on port 80, this should tell you if it's your router forwarding settings or your LSP being actively serious about their "no servers" Terms of Service clause.

share|improve this answer

So obviously you have connectivity with other protocols from those locations? It is not a routing problem?

Packet analysis may offer more information.

Also check the following;

  • use nslookup to verify dns query/response
  • check virual hosts
  • turn verbose logging on the relevant services and examine logs.
share|improve this answer

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.