Configuration basée sur un vieil article de John Coggeshall.
Voici l'implémentation finale. Nous avons deux serveurs Apache. Le premier qui fait office de proxy est en version 1.3.34 avec PHP 4 en module statique ; le second en version 2.2.0 avec PHP 5 en module dynamique.
Phase 1 :
Recompiler Apache 1 avec mod_proxy (ajouter l'option --enable-module=proxy à la configuration).
Phase 2 :
Installer un second serveur Apache sur un autre port, par exemple le 8085. J'ai choisi Apache 2.2.0 et PHP 5.1.2. Voici le script — il suppose que les sources au format tar.bz2 soient préalablement téléchargés dans le répertoire de travail SOFT_DIR.
#!/bin/sh
SOFT_DIR=/home/xtian/src
HTTPD=httpd-2.2.0
PHP=php-5.1.2
# Install Apache
cd $SOFT_DIR
rm -rf $HTTPD
echo Extracting $HTTPD
tar jxf $HTTPD.tar.bz2
cd $HTTPD
./configure \
--prefix=/usr/local/apache2 \
--enable-module=so \
--enable-rewrite \
--with-mpm=prefork \
--with-port=8085
make && make install
# Install PHP
cd $SOFT_DIR
rm -rf $PHP
echo Extracting $PHP
tar jxf $PHP.tar.bz2
cd $PHP
./configure \
--prefix=/usr/local/php5 \
--sysconfdir=/etc/php5 \
--disable-short-tags \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc/php5 \
--with-freetype-dir \
--disable-magic-quotes \
--enable-ftp \
--with-gettext \
--with-gd \
--with-mbstring \
--with-mysql \
--with-openssl \
--with-pdo-mysql \
--with-pear \
--with-png \
--with-zlib
make && make install
Phase 3 :
Configurer les deux serveurs. L'ancien :
<VirtualHost *:80>
ServerName xtian.goelette.info
DocumentRoot /home/xtian/goelette.info
ProxyPass / http://xtian.goelette.info:8085/
ProxyPassReverse / http://xtian.goelette.info:8085/
</VirtualHost>
Le nouveau serveur écoute le port 8085 en local ; pas sur 127.0.0.1 mais sur l'adresse IP publique. La configuration de l'hôte virtuel est transférée dans le nouveau fichier de configuration, par exemple /usr/local/apache2/conf/extra/httpd-vhosts.conf
Listen 213.186.56.126:8085
LoadModule php5_module modules/libphp5.so
NameVirtualHost *:8085
<VirtualHost localhost:8085>
ServerName xtian.goelette.info
DocumentRoot /home/xtian/goelette.info
php_flag magic_quotes_gpc off
CustomLog /home/xtian/goelette.info/logs/access.log combined
</VirtualHost>
Dernière étape
Lancer/relancer les serveurs :
/usr/local/apache2/bin/apachectl start
/usr/local/apache/bin/apachectl graceful