Apache on multiple ports

Question : How do i run apache on multiple ports?


Similar to exim and other services, apache do have capability to run on multiple ports. All you have to do it to edit the httpd.conf file and added a new Listen line which the specific port no which you like to run.


  • # vi /etc/httpd/conf/httpd.conf

Add below the Listen 80 line (for example if you want to run on port 8080)


  • Listen 8080


Restart the service httpd service.


Question : Is it possible to run a single Vhost on different port (example : 8080) and others on the normal port?


Yes, it is possible but is vhost should have a separate(dedicated) ip address, edit the httpd.conf


  • # vi /etc/httpd/conf/httpd.conf

Look and add the following line below the Listen 80 (for example the vhost dedicated ip is


  • Listen


Look below and change the NameVirtualHost to NameVirtualHost


And also in the virtualhost.


  • <VirtualHost>


And this will make the web sever to listen the other ips on port 80 and the ip to 8080. This is especially useful for if you are planning to run varnish cache for a specific domain/vhost which will listen on port 80 (ie.. on ip and apache on port 8080.


Good Luck!