% NGINX # Mode Maintenance ## Fichier d'accueil ```html Site en Maintenance

Site en Maintenance

Merci de revenir plus tard !

``` ## Configuration Ajouter ce bloc: ``` ###### MAINTENANCE ###### #Changer la valeur de maintenance a on ou off (decommenter/commenter la seconde ligne) #set $maintenance off; set $maintenance on; if ($remote_addr ~ (83.193.14.206)) { set $maintenance off; } if ($maintenance = on) { return 503; } location /maintenance { } error_page 503 @maintenance; location @maintenance { root /var/www/maintenance ; #rewrite ^(/images/logo.png)$ /images/logo.png break; rewrite ^(.*)$ /index.html break; } ###### FIN MAINTENANCE ###### ``` Par exemple: ``` server{ listen 443 ssl; # AJOUT DES CERTIFICATS ssl_certificate /etc/letsencrypt/live/garagepourtous.fr/fullchain.pem ; #/etc/letsencrypt/live/garagepourtous.fr/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/garagepourtous.fr/privkey.pem ; # /etc/letsencrypt/live/garagepourtous.fr/privkey.pem; # managed by Certbot server_name www.garagepourtous.fr garagepourtous.fr; root /var/www/www.garagepourtous.fr; index index.php index.html index.htm; access_log /var/log/nginx/fr.garagepourtous.access_log; error_log /var/log/nginx/fr.garagepourtous.error_log; # Security include global/security.conf; ###### MAINTENANCE ###### #ICI ###### FIN MAINTENANCE ###### location / { # This is cool because no php is touched for static content. # include the "?$args" part so non-default permalinks doesn't break when using query string try_files $uri $uri/ /index.php?$args; } # PHP-FPM include global/php-fpm-redis.conf; # STATICS FILES location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } } ``` # Gestion des mots de passe et accès dans nginx ``` sudo sh -c "echo -n 'thomas.richard3:' sudo sh -c "openssl passwd -apr1" ``` Éditer le fichier (par exemple `/etc/nginx/.auth.allow`) # Webographie ## Yunohost * [YunoHost behind a reverse proxy - Discuss / Advanced use case - YunoHost Forum](https://forum.yunohost.org/t/yunohost-behind-a-reverse-proxy/6378) * [Nginx reverse proxy + URL rewrite - Server Fault](https://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite) * [Reverse proxy avec Nginx - Support - YunoHost Forum](https://forum.yunohost.org/t/reverse-proxy-avec-nginx/207) * [Nginx de Yunohost en reverse proxy - Le blog de Genma](https://blog.genma.fr/?Nginx-de-Yunohost-en-reverse-proxy) * [Reverse proxy and Reverse DNS for YunoHost installation - Support - YunoHost Forum](https://forum.yunohost.org/t/reverse-proxy-and-reverse-dns-for-yunohost-installation/25672) * [ACME Client Implementations - Let's Encrypt](https://letsencrypt.org/docs/client-options/)