2 apache httpd instances running on the same host
Posted in Bash on January 21st, 2010 by gmunteanua client of mine wanted to revert to php4, as php5 was not good for his website. i tried to convince him to migrate to a better and newer CMS, no success. the only way to make him happy was to put php4 in place.
My only solution was to place his domain on another apache instance, with libphp4.so loaded, and in lighttpd.conf to direct his domain to that apache instance.
in order to run 2 apache instances you need only to create another httpd.conf file from the existing one and change a few lines. and then with “-f” parameter you launch 2 apaches each having its own configuration file.
As you now from my older posts i have a lighty web server that acts as a proxy to the apache and jetty servers.
in lighttpd.conf i do this:
$HTTP["host"] =~ "(^|\.)DOMAINNAME\.com$" {
$HTTP["url"] =~ "\.php|\/$" {
proxy.server = ( ".php" =>
( "localhost" =>
(
"host" => "127.0.0.1",
"port" => 8094
)
),
"/" =>
( "localhost" =>
(
"host" => "127.0.0.1",
"port" => 8094
)
)
)
}
}
i copied httpd.conf to httpd_php4.conf and added/modified 4 lines:
added PidFile “/usr/local/apachephp/php4pidfile”
added LockFile “/usr/local/apachephp/php4lockfile”
modified: Listen 127.0.0.1:8094
modified: LoadModule php4_module modules/libphp4.so
and started another apache instance that will listen on another port [8094] like this: apachectl -f /path/to/httpd_php4.conf start. if you want to stop this certain instance, or want to restart it, you add -f parameter too, say “apachectl -f /path/to/httpd_php4.conf stop”.