I want to set up a web server on one of my computers (Dell Desktop) and decided on CentOS as the OS. Apache is installed properly (I think. pgrep httpd returns a bunch of processes that are running). I also think that my httpd.conf file is ok (I've read about 4 tutorials on apache setup). My ISP is comcast. I have httpd listening on both port 80 and 8080.

But it's not working and I can't figure out why. I had a friend try to see my test.html page (which is in /var/www/html/ - where it's supposed to be.) and he got http error 504, which seems to relate to a proxy or firewall, neither of which I have.

I have several questions: 1) is there a way to test my setup without having an outside friend try to see my web page? My own browser on the server sees the page fine when I use its local address ( for the url, but the browser on another computer on my network ( cannot see the page. 2) What, specifically, is needed to run a web server? Just a properly configured apache? Assuming I don't need php or any sql functionality. 3) is it possible that comcast is messing up the system somehow? 4) is it possible my own router is messing up the system somehow (can't see it if it is)?

I don't seem to be able to attach my httpd.conf file. I don't want to cut and paste it here because it's too long (even with the comments deleted).

  • Do you "see" the access in httpd error and/or access log?
    – Nils
    Commented Jul 27, 2012 at 21:33
  • Is your default-route directed towards the outside world?
    – Nils
    Commented Jul 27, 2012 at 21:34

5 Answers 5


By default, CentOS has its firewall (iptables) setup to not allow incoming traffic on port 80.

Run this to allow incoming traffic on port 80:

iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Then run this to save the configuration:

/sbin/service iptables save

These commands need to be run as root. No services should need to be restarted for the changes to take effect.

More information on iptables for CentOS can be found in their wiki at CentOS.org in the How To's section.

Regarding your friend not being able to connect:

Your router is most likely keeping him out. The Comcast Cable Modem could also be keeping him out.

Most routers, by default, are setup to use DHCP and routing. This means that your router has assigned your computer(s) an internal IP address according to its own IP range, subnet mask, and gateway. All traffic from your ISP assigned IP address is routed through the router to the IP addresses it has assigned to your computers via DHCP.

In order to allow traffic through the router from external sources on port 8080, you would need to setup port forwarding from an external source on the specified port to your router assigned IP address. This is done in the router configuration.

An alternative to this is to put your computer in a DMZ (demilitarized zone), which will allow all traffic, both incoming and outgoing, to be unfiltered to that computer. Note that this is a huge security risk, and is not suggested. However, should you choose to do so, this setting is also commonly found in the router configuration.

  • Thanks nojak. All that was very helpful, especially the iptables stuff. I hadn't heard or read that about CentOS, although, I can't imagine why, as I had gone though a few CentOS tutorials on setting up a web server. Gracias.
    – bev
    Commented Jul 29, 2012 at 20:11
  • The problem was solved by learning about IPtables. The firewall settings was what was keeping the thing from working
    – bev
    Commented Oct 3, 2012 at 5:35

1) The server may have been configured to allow connections only from the localhost. Check the configuration for allow directives. You likely want to restrict public access to your web content directory. This is likely /var/www or /srv/www. You may also be blocking incoming web access with iptables.

2) Simple html Apache is enough. I believe it is still the dominant web server on the Internet.

3) It is common for ISPs like Comcast to block access to port 80. ISPs usually don't block access to port 8080.

4) To allow your friend to connect from the Internet you will need to port forward port 8080 and/or port 80 to your webserver ( It may cause problems locally if both address are connected using WiFi and isolation is enabled.

The following settings allow access to content under /var/www. It also enables a few options. You should have something similar in your configuration.

    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
  • Thanks. Actually, my httpd.conf file does not have the above. It has <Directory />, but no <Directory /var/www/>. I've included your suggestion.
    – bev
    Commented Jul 29, 2012 at 19:49
  • @bev The <Directory /> could allow access but it is more secure for it to deny from all. The /var/www should match the directory specified as your site's DocumentRoot.
    – BillThor
    Commented Jul 31, 2012 at 0:26

If you think it is iptables (firewall), do service iptables stop and try browsing if you can't get it from a machine that is in the same subnet.

For a friend to be able to get to your web page in an environment that is at home and with simple ISP such as Comcast, AT&T (dynamic IP) then:

  1. Find out your current public IP address.
  2. Set a DHCP reservation for your web server so it receives the same IP address.
  3. Set port forwarding on your router to forward port 80 traffic to your internal webserver.

1) Use the web proxy like hidemyass.com

2) For simple html Apache is enough.

3) Unlikely

4) If the router is between and it can cause problems if incorrecly configured. If it is not than the problem is either apache config, iptables rules or possibly some IPS if you have one...


netstat -cpatn

command on the server to see incomming connections while accessing the page from other computer.

you can use

tcpdump -X -s0 "dst port 80 and src port 80"

to analyze the trafic further.


This looks like a router issue. To make sure you can see the page on another computer on the same network, make sure you can forward the ports from the router page. In your case, it's most pronabl

You must log in to answer this question.

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