By Yaniv Yemini
Httpd-Multi is a set of scripts that will help you manage multiple instances of Apache 2.2.
It is distributed under the Apache 2.0 license.
The scripts are now hosted on Github: GitHub httpd-multi
To control an Apache instance, use apachectl-multi, just like you would use the original apachectl that comes with Apache, but with the server instance's root directory name as the first argument:
apachectl-multi www start
In this example, the first argument "www" is the Apache instance's ServerRoot directory name (see How to Install the scripts for an example of how to set up the server instances).
The second argument for apachectl-multi is one of the control commands that you would normally use with Apache's apachectl:
Following are instructions how to use the scripts.
Create ServerRoot directories
The first step is to create an Apache ServerRoot for each instance of Apache under one base directory. In this example, we will use /usr/local/apache/sites as the base directory:
/usr/local/apache/sites
www/
blog/
forum/
Each subdirectory under /usr/local/apache/sites is an Apache ServerRoot directory with the following structure:
Configure each instance httpd.conf so paths to the logs, LoadModule, DocumentRoot and other directives will point to the correct locations.
git clone https://github.com/yanivyam/httpd-multi.git
cp apachectl-multi /usr/local/apache/bin
cp httpd-multi /etc/init.d/
The next step is to setup httpd-multi, which is the init.d script that is responsible of starting and stopping Apache instanaces during boot and shutdown of the server.
Usually, this involves copying httpd-multi to your init.d directory, and then use chkconfig utility tell the system when to call the script during boot and shutdown processes.
You can browse the code on GitHub: https://github.com/yanivyam/httpd-multi.
Or, download the latest version of httpd-multi for Apache 2.2 from GitHub:
git clone https://github.com/yanivyam/httpd-multi.git