Search code examples
apache2apache-config

Configure apache to listen on port other than 80


I use centOS server. I want to configure apache to listen on port 8079. I added LISTEN 8079 directive in httpd.conf.
I opened port 8079 in iptables and restarted iptables. I even stopped iptables service.

"netstat -nal | grep 8079" shows "tcp  0 0 :::8079 :::* LISTEN"

If I try to access http://localhost:8079 or http://myserver.com:8079 from that machine, I can access that page. BUT from any other machine I am not able to access the site on any port other than 80. On port 80, it works. On port 8079 it does not.

What else do I need to configure?


Solution

  • It was a firewall issue. There was a hardware firewall that was blocking access to almost all ports. (Turning off software firewall / SELinux bla bla had no effect)

    Then I scanned the open ports and used the port that was open.

    If you are facing the same problem, Run the following command

    sudo nmap -T Aggressive -A -v 127.0.0.1 -p 1-65000
    

    It will scan for all the open ports on your system. Any port that is open can be accessed from outside.

    Ref.: http://www.go2linux.org/which_service_or_program_is_listening_on_port