I'm trying to get Apache to listen to a non-standard port, running on Ubuntu 10.04.

I've added a "Listen" line in /etc/apache/ports.conf, and restarted Apache. I can now access my websites through that non-standard port, when running a browser on that machine, but I cannot, when trying to access Apache from any other machine on the local network.

I've tried to telnet to the IP address and port, from another machine on the local network, and it timed out.

Clearly something in the Ubuntu configuration is blocking the port.

Any ideas as to what? It's pretty much an out-of-the-box configuration.



Step 1: Verify that Apache is listening on the port on an external interface (or all interfaces).
You can do this with netstat -an | grep LISTEN | grep <PortNumber> -- I assume this is already the case, but assume you just got the card-reading guy at Tech Support and check again anyway :-).

Step 2: Verify that your server does not have any firewall rules blocking this non-standard port.
You can do this with iptables -L, or the ufw tool that comes with Ubuntu.

Step 3: Verify that you can reach the web server on an external IP from itself.
This can be as simple as using telnet to connect to the outside IP on the appropriate port and sending GET / HTTP/1.0 followed by Enter twice. If this doesn't work something's still messed up locally and you can start hunting through logs to find out what (triple-check the firewall, check Apache's logs, etc.).

Step 4: Verify that there are no other firewalls in the way blocking this traffic.
This one usually requires outside cooperation from firewall admins along the path between your client and server.

  • 1
    UFW was running, and only allowed ports 22, 80, and 5901. I added my new port, and things are working fine. Thanks. – jdege Mar 9 '11 at 18:54

It might not be Ubuntu blocking the non-standard port. It could very well be a firewall or router between the two machines which is not allowing connections on that port to your server. You probably need to set up some port forwarding to allow traffic on your non-standard port to access your web server.

Though it could also be a Ubuntu software firewall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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