apache2 two instances
hakan at koseoglu.org
Fri Aug 20 20:16:32 UTC 2010
On 20 August 2010 18:38, Kaushal Shriyan <kaushalshriyan at gmail.com> wrote:
>>> Can someone please guide me to setup two instances of apache2 along with
>>> start/stop init.d script for both the instances.
> What are the implications to have multiple instances of apache2 ?
Please explain what you are trying to achieve.
This sounds like someone's homework or project work.
it is doable, it's not worth the hassle with the Ubuntu defaults. Much
easier to roll your own versions with separate prefixes but even then
it's not worth the hassle in most cases. We do it with our customers
to completely isolate Apache instances from each other on CentOS &
RHEL but we don't depend on a lot of external libraries. We trim the
compilation to a few options we require and it turns out to be very
tight, secure and small. OTOH, we miss out on the automated updates so
there's a bad side of it.
If you run multiple Apache instances, they must listen on different
ports (i.e., standard 80 and something else). This is usually more
easy to manage with virtual servers.
The only reason you should have separate Apache instances is when you
have conflicting libraries/modules and applications loaded. Again,
separate applications should be separated by virtual hosts.
You can run multiple instances by having separate config directories
and running the daemon with additional parameters. You can take a copy
of /etc/init.d/apache2 and add necessary modifications.
Check apache2's man page. You will be interested with the -f
parameters to supply a separate Apache config. Default config is in
/etc/apache2/apache2.conf. Don't forget to change log directories,
Server root, Listening port.
Then you need to register the new init file and test.
As I said, you can always compile your own Apache to a completely new
area but that will not pick up any updates and compiling/obtaining
prerequisites can be a bummer (the combination of Apache 2.2, PHP5 and
AIX's XLC are a nightmare - count yourself lucky - I've been there,
still having the nightmares).
Hakan (m1fcj) - http://www.hititgunesi.org
More information about the ubuntu-users