Dans ce cas de figure, nous utilisons un reverse proixy Nginx qui pointe vers des machines d’hébergement LAMP
Activer la réécriture d’URL pour Apache2
Ajouter dans le fichier de conf du vhost (nom_du_site)
<Directory /var/www/nom_du_site>
AllowOverride all
</Directory>
Configuration du reverse proxy Nginx
server {
if ($host = nom_du_site) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name nom_du_site;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name nom_du_site;
access_log /var/log/nginx/nom_du_site/access.log;
error_log /var/log/nginx/nom_du_site/error.log;
# On rend le reste directement
location / {
proxy_pass http://192.168.9.12;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Proto https;
# auth_basic "Username and Password Required";
# auth_basic_user_file /etc/nginx/htpasswd;
# try_files $uri $uri/ =404;
}
ssl_certificate /etc/letsencrypt/live/nom_du_site/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/nom_du_site/privkey.pem; # managed by Certbot
}
Commentaires récents