Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to ask a question, regarding whether it is possible to have multiple separate Apache daemons running on the same machine. I do not refer to multiple apache processes. I know this is doable. I am talking about completely separate daemons. I am familiar with the concepts of VirtualHosts, and know how to run multiple websites on the same machine, but this is not what I need.

In detail, I am running a web application on a machine. An apache configuration files directs the web requests to the relevant location, or wsgi app. However, I need to setup a reverse proxy on the same machine. The configuration file of the reverse proxy will be constantly updated with more and more entries. For this reason, I would like to have a separate apache daemon to run the reverse proxy, so that any possible syntax error on the reverse proxy's Apache configuration file, will not affect/crash the web application. First of all, is this the way to go? Or is there another way to isolate the 2 applications(web app, reverse proxy), so that they don't affect each other? If yes, how is it possible?

Thanks in advance.

share|improve this question
Update: Eventually I realized that 2 separate apache daemons will be an overkill. I think it's easy to mess up in that way. Therefore I went for the option of separate config files. Each config file will correspond to a ./deploy script. This script will first validate all apache configuration files (using apachectl configtest) and only if they are all valid, will restart the apache server. – Charalambos Paschalides Sep 27 '11 at 13:26

You can absolutely do this - each daemon needs its own config file and (very important) different TCP ports that they listen on. You can't have multiple processes listening on a single port.

share|improve this answer
How is this achieved though? And, when you want to start/stop one of the daemons, how do you specify with one? – Charalambos Paschalides Sep 26 '11 at 15:24
I've seen it done with parallel install directories - you would have /opt/apache1 and /opt/apache2 (for example). To start/stop, you run the command from the proper directory. – mfinni Sep 26 '11 at 15:47

You don't need 2 separate daemons, this may be done with port-based virtualhosts.

share|improve this answer
What do you mean? Still in this case, an error in one .conf file will affect the other app, right? – Charalambos Paschalides Sep 26 '11 at 15:23

Sorry, I've read your question inattentively.

If you install apache from source, just install 2 separate installations in 2 separate directories: /opt/apache2_webapp and /opt/apache2_rproxy.

If you want to use package manager, the simpliest way is to install one of servers into chroot. For example, in Debian/Ubuntu there is very convenient Multistrap tool.

If you want to use the same package for running 2 separate servers, you should copy init script, settings directory, pid files directory, log directory, data directory with other names, for example in Debian/Ubuntu:

cp -r /etc/init.d/apache2 /etc/init.d/apache2_rproxy
cp -r /etc/apache2 /etc/apache2_rproxy
cp -r /etc/default/apache2 /etc/default/apache2_rproxy
cp -r /var/run/apache2 /var/run/apache2_rproxy
cp -r /var/log/apache2 /var/log/apache2_rproxy
cp -r /var/www /var/www_rproxy

Then change all paths in new init script and config files, try start/stop new init script to fix possible errors, and add new init script to required runlevels.

P.S. IMHO using 2 separate daemons is overkill. You may set up port-based virtualhost solution, and create script, that will run apache2ctl configtest before each reverse proxy config change and discard this change if test fails.

share|improve this answer
Thanks a lot. Very thorough response. I can see it becoming a big mess with 2 Apache instances, so I will try to avoid it :) – Charalambos Paschalides Sep 27 '11 at 13:25

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.