Apache Proxy inverse sort par un proxy

Exemple de configuration Apache

http://monsite.fr => http://monsite.fr/sitedistant

Activation des modules apaches

a2enmod proxy proxy_http proxy_connect

/etc/apache2/conf.d/truc.conf

# Conf Proxy inverse AllowCONNECT 443 SSLProxyEngine on ProxyPass /Truc/ https://monsite.fr/Arbo/ # retry=0 ProxyPassReverse /Truc/ https://monsite.fr/Arbo/ # Conf client proxy # Si le serveur doit sortir par un proxy ProxyRemote * http://192.168.2.104:3128

On vérifie la conf

apachectl -t

On recharge la conf Apache

service apache2 reload

Exemple de conf/directives de reverse proxy Apache

<VirtualHost *:80> ServerName jenkins.acme.fr <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </IfModule> </VirtualHost> <VirtualHost *:443> ServerName jenkins.acme.fr SSLEngine On SSLCertificateFile /etc/ssl/certs/wildcard_acme.fr.crt SSLCertificateKeyFile /etc/ssl/private/wildcard_acme.fr.key SSLCertificateChainFile /etc/ssl/certs/wildcard_acme.fr_ca-bundle.crt SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on # apache 2.1+ <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/jenkins/(.*) https://jenkins.acme.fr/$1 [R,L] </IfModule> ProxyPass / http://127.0.0.1:8880/jenkins/ nocanon ProxyPassReverse / http://127.0.0.1:8880/jenkins/ ProxyPassReverse / https://jenkins.acme.fr/ ProxyRequests Off ProxyPreserveHost On AllowEncodedSlashes NoDecode </VirtualHost>

Ou moins impactant

<VirtualHost *:80> ServerName jenkins.acme.fr <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/$ http://jenkins.acme.fr/jenkins/ [R,L] </IfModule> ProxyPass /jenkins/ http://127.0.0.1:8880/jenkins/ ProxyPassReverse /jenkins/ http://127.0.0.1:8880/jenkins/ </VirtualHost>