Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
I'm not familiar with mod_rails. Just out of curiosity, why can't you use different certs on different virtual hosts? –  Mark Porter Dec 17 '09 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. –  Anonymous Dec 17 '09 at 18:21

2 Answers 2

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

PidFile /var/run/server2.pid

for example

share|improve this answer
    
Does this file require any contents or is just used a pointer or sorts? –  Anonymous Dec 17 '09 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. –  brent Dec 17 '09 at 18:36

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.

share|improve this answer
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. –  brent Dec 17 '09 at 15:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.