Running a Second Instance of Apache
One of the benefits of Apache HTTP Server is that you can run multiple instances of it as virtual hosts (as in shared hosting scenarios). In some cases, you may want a public instance of Apache for an IP address/domain and then another private instance running on a separate port. On a dedicated server or virtual private server (VPS) running Apache, you can do very easily accomplish this.
Rather than installing a second version of Apache, all you have to do is set a virtual host instance of the currently running Apache to use a different port. To do this, edit the Apache configuration file found in /etc. On CentOS and many other Linux distributions, you can find it at /etc/httpd/conf/httpd.conf.
Somewhere in that file, you will see the current host setup, which tells Apache which port to listen on:
Listen 80
If, for example, you wanted to create a second instance running on port 8080, you would set it up like this:
NameVirtualhost 192.168.0.1:80
NameVirtualhost 192.168.0.1:8080
Each host will additionally have its own configuration settings:
Many web-based control panels allow you to easily create virtual hosts, and some, like Virtualmin, make it easy to add a virtual host on a different port. Consult your control panel’s documentation for help creating virtual hosts.
Related Posts
- Apache Tomcat – Java Servlet and JSP
- How to Hide Files from Apache Directory Listings
- 4 Tips to Secure Apache Web Servers
- Apache Web Server Directives
- 4 Things You Can Do When Your Server Is Running Perfectly

