httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sheryl" <>
Subject Re: [users@httpd] Configuring multiple instances of apache on the same machine
Date Tue, 24 Jul 2007 15:02:20 GMT
Joshua wrote:

> It's relatively trivial if you do it in the simplest way:
> Configure/compile/install with different --prefix's each time (meaning
> one instance lives entirely under /usr/local/apache2a, another under
> /usr/local/apache2b, etc). Then the only thing you need to do is
> adjust the Listen directive to tell the correct IP-address/port.

To each his own.  Multiple compile and install doesn't seem like a simple
way to me.

What we do at my job is one installation of the software, say in
/opt/httpd-2.2.4.  The in /opt/data we make a separate directory for each
instance.  Like /opt/data/foo1, /opt/data/foo2 where and are virtual hosts set up via ifconfig on redhat.

In /opt/data/whatever there's an apache directory, a php directory, a
mysql directory, etc.  The php directory is for setting PHPRC so you can
have different php.ini files for the various installations.  The apache
directory has a link "base" which points to /opt/httpd-2.2.4 (or whatever
install directory).  Links like base/bin, base/lib, base/icons, etc. point
to directories in /opt/httpd-2.2.4 which can safely be shared.  The
htdocs, conf, cgi-bin and logs subdirectories are not links.  The
httpd.conf is changed so DocRoot and other variables point to the instance
directory rather than the software installation directory.  We use Named
Virtual Hosts for the actual host setup.  That's probably not absolutely
necessary, but it makes it easy if we decide to run another name on the
same IP later or put the HTTP and HTTPS sides in different docroots.

In /etc/init.d we have a script which loops through the host names and
starts each one.  We set global variables to plug into the startup command
so that the right files are picked up for each instance.

It probably sounds a little complicated, but the brilliance of it is that
if you install a new version of apache you may be able to just change the
base pointer and go if the software doesn't change very much.  And no
compilation is required if you want to make a new instance.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message