75 lines
2.4 KiB
Plaintext
75 lines
2.4 KiB
Plaintext
# ==============================================================================
|
|
# Configuration Nginx pour ter-ferrovia.mrpatator.fr
|
|
# Emplacement sur le serveur : /etc/nginx/sites-available/ter-ferrovia.mrpatator.fr
|
|
# ==============================================================================
|
|
|
|
# Redirection HTTP -> HTTPS
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name ter-ferrovia.mrpatator.fr;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
# Bloc HTTPS
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name ter-ferrovia.mrpatator.fr;
|
|
|
|
# Certificats SSL Let's Encrypt
|
|
ssl_certificate /etc/letsencrypt/live/ter-ferrovia.mrpatator.fr/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ter-ferrovia.mrpatator.fr/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
# En-têtes de sécurité
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
|
|
# Compression Gzip
|
|
gzip on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
|
|
|
|
# Cache des fichiers statiques Next.js (_next/static)
|
|
location /_next/static/ {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_set_header Host $host;
|
|
expires 365d;
|
|
access_log off;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# Reverse Proxy vers Next.js (PM2 port 3000)
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
|
|
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-Host $host;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|