0

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.

2
  • I'm not familiar with mod_rails. Just out of curiosity, why can't you use different certs on different virtual hosts? Commented Dec 17, 2009 at 16:37
  • You just can't. I've read it in the documentation. It will only read and use the first cert specified for all vhosts. They may have updated, but I haven't seen it in the docs. mod_rails is the name of Phusion Passenger. This short coming aside, its one of the best ways to server Ruby on Rails applications. Commented Dec 17, 2009 at 18:21

2 Answers 2

3

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

PidFile /var/run/server2.pid

for example

2
  • Does this file require any contents or is just used a pointer or sorts? Commented Dec 17, 2009 at 18:24
  • The pid file is used by Apache to store its PID (process ID), so it is a pointer to the running Apache process. It will create it if needed and will write to it. Therefore, the path must be writable by the Apache process. Commented Dec 17, 2009 at 18:36
1

There's a good guide here:

http://blog.datajelly.com/company/blog/46-multiple-apache-instances-in-ubuntu.html

Essentially, you need two separate httpd.conf files which define two separate LockFile and PidFile directives.

1
  • 1
    Changing LockFile is unnecessary according to Apache2 docs: > The LockFile directive sets the path to the lockfile used when Apache is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. ... The PID of the main server process is automatically appended to the filename. Commented Dec 17, 2009 at 15:32

You must log in to answer this question.