how to tell if you're listening on port 80
by clsgis - 4/28/07 6:05 PM
In Reply to: httpd by library_12_5
Open a web browser to http://127.0.0.1/. Port 80 is the default for HTTP. If you get an immediate connection refused, then nobody is listening there. Your firewall should not be messing with traffic to or from 127.0.0.1 because that's your computer's address for talking to itself. No other computer can connect to it there.
If you don't tell it otherwise, Apache will listen for incoming connections to port 80 on every network interface on your computer. So by default, Apache will be listening to 127.0.0.1. It will also try to listen on any interface your computer uses to see the Internet. If your MS-Windows computer is connected directly to the Internet through a DSL or cable TV modem, which is a really really bad idea, Apache is trying to listen through it. Open your web browser to someplace like http://www.lawrencegoetz.com/programs/ipinfo/ or http://www.ipaddressworld.com/ (disable popups first) to find out what IP address you're looking at the world from. Now open your web browser to that IP address. Even better, go to someplace like http://www.netmonitor.org/tools/test.php?type=www and let it tell you what it sees. Is your computer listening for incoming to port 80 there?
My advice is do not let Apache listen to your routable address on a Microsoft box. Apache itself is quite sturdy, and so (believe it or not) is the network stack in Microsoft's kernel. The problem is that it will attract attention. Criminals are constantly scanning the IP address space for computers to break into. If they see a Microsoft box is listening to port 80 in the middle of a residential "broadband" address range, they will start probing its other ports looking for other "services" less robust than Apache. And if you don't know what you're doing, they will find some.
Edit your Apache configuration file. Look for the line that says "Listen 80". Is it commented out? Then remove the comment character. Change the line to read "Listen 127.0.0.1:80" (without the quotes, all on one line). Restart Apache. Now it will only be listening to your own computer instead of the whole world, and you can experiment with it safely.
When I say Apache is robust, I'm oversimplifying. Apache itself is very solid. But you can easily misconfigure it. You can easily do dumb things with Server Side Include directives and PHP code. There are tons of really bad (insecure) PHP and CGI programs available. Read the manual at http://httpd.apache.org/docs/ before you hurt yourself. Go through your httpd.conf file and figure out what each directive is doing. Learn to use the "Directory" container and the Allow From and Deny From directives.
Was this reply helpful? (0) (0)