A6 – Apache Reverse proxy, Réécriture d`url

Transcription

A6 – Apache Reverse proxy, Réécriture d`url
A6 – Apache
Proxy, reverse proxy
ESIROI 2014-2015
Proxy
Client
Serveur
Proxy
Reverse proxy
Serveur 1
Serveur 2
Client
Reverse proxy
Serveur 3
Intérêts
•?
Intérêts
• Mise en cache
• Distribution de charge (load balancing)
• Séparation de l’authentification
• Séparation de la sécurisation : filtrage, SSL, …
Proxy Apache
• mod_proxy
•
•
•
•
Mod_proxy_http : proxy HTTP
Mod_proxy_ftp : proxy FTP
Mod_proxy_connect : Tunnel SSL au travers du proxy
Mod_proxy_balancer : proxy HTTP, FTP, AJP13 avec répartition de charge
Proxy (mandataire direct)
<VirtualHost *:8080>
ServerAdmin [email protected]
ServerName proxydirect.millerioux.com
ProxyRequests On
#Mode mandataire direct
ProxyVia On
#Contrôle des entêtes HTTP
<Proxy http://cours.millerioux.com>
#Filtrage sur l’url demandée
order deny, allow
deny from all
#Filtrage des clients (Important !)
allow from 192.168.10.0/24
</Proxy>
ErrorLog /var/log/apache2/proxydirect-error.log
LogLevel warn
CustomLog /var/log/apache2/proxydirect-access.log combined
</VirtualHost>
Reverse proxy (mandataire inverse)
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName cours.millerioux.com
ProxyPass /A6/ http://192.168.100.12/
#Redirection vers http://192.168.100.12/
ProxyPassReverse /A6/ http://192.168.100.12/
#Réécriture des redirection d’url
ProxyPreserveHost On #Préservation du HOST (Ex : backend avec NameVirtualHost)
#ProxyAddHeaders Off #Apache 2.4, Ne pas réécrire les entêtes (Ex : CakePHP 2.X et referer())
ErrorLog /var/log/apache2/web-error.log
LogLevel warn
CustomLog /var/log/apache2/web-access.log combined
</VirtualHost>
Reverse proxy et backend SSL
<VirtualHost *:80>
[…]
SSLProxyEngine On
#Activation du proxy SSL
SSLProxyCACertificateFile /etc/apache2/ssl/certificat.crt #Certificat du serveur « proxyfié »
ProxyPass / https://192.168.100.12/
ProxyPassReverse / https://192.168.100.12/
ProxyPreserveHost On
ErrorLog /var/log/apache2/web-ssl-error.log
LogLevel warn
CustomLog /var/log/apache2/web-ssl-access.log combined
</VirtualHost>
Reverse proxy et load balancing
<VirtualHost *:80>
[…]
<Proxy balancer://cluster>
BalancerMember http://server1
BalancerMember http://server2
</Proxy>
ProxyPass / balancer://cluster
ProxyPassReverse / balancer://cluster
</VirtualHost>
#Création du « cluster »
#Serveur backend 1
#Serveur backend 2
#Reverse proxy vers le « cluster »

Documents pareils

Fonctionnement et mise en place d`un reverse proxy

Fonctionnement et mise en place d`un reverse proxy ServerName www.example1.com # Autres directives ici

Plus en détail

Présentation Reverse Proxy

Présentation Reverse Proxy Nous possédons une application interne qui est accédée au sein du réseau interne via l’URL http://monapp.mon-domaine-interne/. Nous souhaitons y accéder depuis l’internet par l’intermédiaire de l’a...

Plus en détail