66 lines
2 KiB
Text
66 lines
2 KiB
Text
# 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;
|
|
}
|
|
|
|
location / {
|
|
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;
|
|
}
|
|
}
|