51 lines
1.9 KiB
Text
51 lines
1.9 KiB
Text
|
|
# Groupe Méditation — Configuration NGINX
|
||
|
|
# Reverse proxy vers Apache (frontend) et FastAPI (backend)
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name groupe-meditation.chezlepro.ca;
|
||
|
|
|
||
|
|
# Certificat Let's Encrypt
|
||
|
|
ssl_certificate /etc/letsencrypt/live/groupe-meditation.chezlepro.ca/fullchain.pem;
|
||
|
|
ssl_certificate_key /etc/letsencrypt/live/groupe-meditation.chezlepro.ca/privkey.pem;
|
||
|
|
|
||
|
|
# Headers de sécurité
|
||
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
|
||
|
|
add_header X-Content-Type-Options nosniff always;
|
||
|
|
add_header X-Frame-Options DENY always;
|
||
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
||
|
|
add_header Referrer-Policy strict-origin-when-cross-origin always;
|
||
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' fonts.googleapis.com; font-src fonts.gstatic.com; img-src 'self' data:; connect-src 'self'" always;
|
||
|
|
|
||
|
|
# Frontend — Apache sert les fichiers statiques
|
||
|
|
location / {
|
||
|
|
proxy_pass http://127.0.0.1:8080;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Backend API — FastAPI via Uvicorn
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://127.0.0.1:8000;
|
||
|
|
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;
|
||
|
|
|
||
|
|
# Rate limiting anti-brute force (PIN)
|
||
|
|
limit_req zone=api_limit burst=10 nodelay;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Taille max des uploads
|
||
|
|
client_max_body_size 5M;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Redirection HTTP → HTTPS
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name groupe-meditation.chezlepro.ca;
|
||
|
|
return 301 https://$host$request_uri;
|
||
|
|
}
|