How can I find out if a port is opened or not?

Solution 1:

If you are just spot checking your ports from the outside. Use this tool:

It will attempt to connect to your IP address, on the specific port, and let you know if it is open or closed to the outside world.

Local issues too? Sounds like the Windows 7 firewall is cutting you off. Add an exception with this tutorial...

Solution 2:

Running netstat -a -n or ss -a -n from a command prompt will show all of the network connections open and the listening ports on your machine. would mean that it is listening on port 80 of all ip addresses (localhost and your public/private IP addresses) where as would mean it is only listening on localhost. You can add -b to the command and it will show which executable is using that port. You can get the same information using the Resource Monitor in Windows 7 under the Listening Ports section of the Network tab.

Solution 3:

If you want to see if it is open from another server you can just telnet serverName 80 and see if the session opens. If it doesn't, than the either the server is not listening, or the port is blocked by a firewall.

If it opens and then closes right away, at least windows 2003, then the software (such as Exchange) might not be configured to listen on that particular interface or IP, but it is listening on other ports. I have seen IIS behave this way because it is stupid, Apache might not.

Solution 4:

You wrote:

In the first case I get: Forbidden You don't have permission to access / on this server.

Although this may sound strange, you actually don't have a problem with open ports (but with Apache config).

That "Forbidden" message comes from your Apache server; it means that your webserver is accessible from the Internet.

You need to configure Apache to allow serving to all hosts - otherwise they'll get the "Forbidden" page. IIRC, Apache is initially set up to only allow requests from the local computer.

Somewhere in your Apache config, there's probably a section like this (the actual directory may be different):

<Directory "/home/piskvor/www">
    Allow from
    Deny from all

If you want to allow any computer to see your pages, you need to change the Deny from all to Allow from all. See the access module documentation for more info.