Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 551
vivek.m Avatar asked Oct 15 '10 09:10

vivek.m


People also ask

Can Apache listen on multiple ports?

Multiple ports can be configured via Listen directive under Apache web server. By default httpd listens on TCP port 80.

Does Apache have to run on port 80?

During installation, port 80 is required to install the Apache web server. If you have another product installed that uses port 80, you must change the Apache HTTP port to another port number before you start the application that is using port 80.

How do I run Apache on port 443?

If you opt for the TLS configuration, the server will listen for secure connections on port 443. In order to instruct Apache web server to bind and listen for web traffic on other ports than the standard web ports, you need to add a new statement containing the newly port for future bindings.


1 Answers

In /etc/apache2/ports.conf, change the port as

Listen 8079 

Then go to /etc/apache2/sites-enabled/000-default.conf

And change the first line as

<VirtualHost *: 8079> 

Now restart

sudo service apache2 restart 

Apache will now listen on port 8079 and redirect to /var/www/html

like image 175
Shankar ARUL Avatar answered Sep 20 '22 12:09

Shankar ARUL