Running multiple Apache2 instances on Ubuntu

apache-2.2

I have two different config files (server1.conf & server2.conf). I need to use each of them to spawn an instance of apache.

/etc/init.d/apache2 start does let me specify which config file apache uses, it defaults to apache2.conf.

apache2ctl -f /etc/apache2/server1.conf -k start works, but when I try to spawn another instance it says that the PID is already in use.

apache2 -f /etc/apache2/server1.conf -k start I get an error saying apache2: bad user name ${APACHE_RUN_USER}.

How can I fix this?


AS an aside, I need to instances of Apache running because I'm using mod_rails/passenger with it at that will only support one SSL certificate (even if you specify many). Hence, 2 instances to 2 support 2 certs.

Best Answer

Change the PidFile path in one of your configs, they're trying to use the same one.

PidFile /var/run/server2.pid

for example