0

I have a live Apache2/MPM-Worker instance running Django. I want to also run an Apache2/MPM-prefork instance to run some Drupal6 applications on the same host machine and utilize a vast selection of PHP modules that run on the prefork model.

I plan to use my MPM-worker instance to reverse proxy to the Apache2-prefork instance for URLS starting with myhost.com/drupal6/. It seems theoretically doable/configurable by having the second Apache2-prefork instance configured to listen on an internal port, say 127.0.0.1:8080 and having my current Apache2-worker configured to proxy pass and reverse pass to it for the 'drupal6' URLs.

However, how do I compile or install the apache2-prefork version so it has a different executable name than /usr/sbin/apache2, for example /usr/sbin/apache2p, and so apache2ctl has a different name, say apache2pctl, and that apache2pctl invokes the /usr/sbin/apache2p instead of /usr/sbin/apache2... and so on down the line (eg /etc/apache2p) so I can start and restart my two instances independently?

As I understand it, no one executable of 'apache2' can be compiled with both the MPM-prefork and MPM-worker modules, so it seems I need two separate versions of the apache2 MPM flavors. But then I need to invoke and control them by separate names, I assume. I looked at the configuration options for apache2 and I am a bit queasy about compiling a second apache2 version with prefork because I am not sure I can set all the options so that none of my current apache2 files is overwritten. Is there a way?

Is there a standard solution to separately installing and controlling prefork and worker apache2 executables on the same machine without them stepping on each other during installation or operation?

2 Answers 2

0

The apache wiki at wiki.apache.org has the answer for me. My main concern was not clobbering files in my current version of apache2 when creating a new apache2, and I had not seen a configuration option before to control where apache2ctl is copied to. However, it's there, and this page leads me to believe that all apache2 files are accounted for and that config.layout allows one to direct where all of them go. http://wiki.apache.org/httpd/DistrosDefaultLayout#Apache_httpd_2.2_default_layout_.28apache.org_source_package.29:

0

You don't have to have two installed copies, but you do need two different configurations.

This all depends on the OS you're using, I can tell you how to do it in Debian and Ubuntu:

  1. Decide on a name for your new instance. Let's say DRUPAL.
  2. Create a new configuration directory for your new instance, copy the original: cp -a /etc/apache2 /etc/apache2-DRUPAL
  3. create startup script link: ln -s /etc/init.d/apache2 /etc/init.d/apache2-DRUPAL

Now edit your new configuration in /etc/apache2-DRUPAL. You can change the web server username in /etc/apache2-DRUPAL/envvars, listening ports in /etc/apache2-DRUPAL/ports.conf etc.

With Apache 2.4 you can also have different MPMs installed at the same time so you can use different ones in your instances, which is your requirement.

After you're done with the configuration, run these commands:

    service apache2-DRUPAL start
    update-rc.d apache2-DRUPAL defaults

The first one checks the configuration and start your new instance. If it doesn't work, do the usual Apache debugging to get it working.

The second line just creates default rc links for startup.

If you wan't to run Apache commands without going through /etc/init.d/apache2-DRUPAL, you have to run . /etc/apache2-DRUPAL/envvars before running them. I think this is Debian/Ubuntu specific. When you do that, you'll notice that apache2ctl, apache2 -S and others are operating from your new configuration.

That's it. No need for manual installation and cluttering of your system :)

HTH.

P.S.: https://wiki.apache.org/httpd/RunningMultipleApacheInstances seems like a good starting point to explore further.

1
  • I'm just trying this out (haven't used it before) and it seems you have to also set the environment variable APACHE_CONFIDIR=/etc/apache2-DRUPAL before sourcing /etc/apache2-DRUPAL/envvars.
    – Borut Mrak
    May 25, 2014 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .