add maintenance mode to nginx
This commit is contained in:
parent
ab2a9bfa4d
commit
6dd56b94ef
4 changed files with 184 additions and 1 deletions
27
docs/maintenance.html
Normal file
27
docs/maintenance.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Photo Server | Maintenance</title>
|
||||
</head>
|
||||
<body style="display: flex; width: 100vw; height: 100vh; align-items: center; justify-content: center; margin: 0px;">
|
||||
<div>
|
||||
<center>
|
||||
<h1>Maintenance Mode | Serveur Photo en maintance</h1>
|
||||
</center>
|
||||
|
||||
<hr>
|
||||
<center>
|
||||
<h3>The server will be back soon | Le serveur photo reviendra au plus vite, soyez patient</h3>
|
||||
</center>
|
||||
<hr>
|
||||
<center>
|
||||
<h3>Contact Us | Pour nous contacter</h3>
|
||||
<a href="mailto:photos@crans.org">photos@crans.org</a>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
80
docs/nginx_photo_maintenance
Normal file
80
docs/nginx_photo_maintenance
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# This file is part of photo21
|
||||
# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later**
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name photos.crans.org;
|
||||
location / {
|
||||
return 302 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name photos.crans.org;
|
||||
|
||||
# Keep the TCP connection open a bit for faster browsing
|
||||
keepalive_timeout 70;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/photos.crans.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/photos.crans.org/privkey.pem;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:MozSSL:10m;
|
||||
ssl_session_tickets off;
|
||||
ssl_dhparam /etc/letsencrypt/dhparam;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
|
||||
# Enable OCSP Stapling, point to certificate chain
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
ssl_trusted_certificate /etc/letsencrypt/live/photos.crans.org/chain.pem;
|
||||
|
||||
error_log /var/log/nginx/photos.crans.org_error.log;
|
||||
access_log /var/log/nginx/photos.crans.org_access.log;
|
||||
|
||||
# Allow 2Go upload at once
|
||||
client_max_body_size 2G;
|
||||
|
||||
add_header "X-XSS-Protection" "1; mode=block";
|
||||
|
||||
# Django statics and media
|
||||
# Do not directly serve media, it must be authorized
|
||||
# by a Django view to check permissions
|
||||
location /protected/media {
|
||||
internal;
|
||||
alias /var/www/photos/photo21/media;
|
||||
}
|
||||
|
||||
location /static {
|
||||
alias /var/www/photos/photo21/static;
|
||||
}
|
||||
|
||||
error_page 503 /maintenance.html ;
|
||||
|
||||
location /maintenance.html {
|
||||
try_files /var/www/photos/photo21/docs/maintenance.html =404;
|
||||
}
|
||||
|
||||
location / {
|
||||
set $maintenance 0;
|
||||
if (-f /var/www/photos/photo21/docs/maintenance.flag){
|
||||
return 503;
|
||||
}
|
||||
|
||||
|
||||
uwsgi_pass unix:///var/run/uwsgi/app/uwsgi_photos/socket;
|
||||
include /etc/nginx/uwsgi_params;
|
||||
proxy_connect_timeout 600;
|
||||
proxy_send_timeout 600;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue