`listen 443 ssl http2` has been deprecated since nginx 1.25.1 in favour of a separate `http2 on;` directive, and Let's Encrypt no longer publishes an OCSP responder URL in its certificates, so `ssl_stapling` had nothing to staple. Both warned on every reload — noise that now matters more, since nginx reloads itself every 6h to pick up renewed certificates. Reloads are clean afterwards and HTTP/2 is still negotiated.
118 lines
3.7 KiB
Plaintext
118 lines
3.7 KiB
Plaintext
# NGINX Configuration Template for Server Panel
|
|
# Replace DOMAIN_NAME with your actual domain
|
|
|
|
# HTTP - redirect to HTTPS
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name DOMAIN_NAME;
|
|
|
|
# Let's Encrypt challenge
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
# Redirect all HTTP to HTTPS
|
|
location / {
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
# HTTPS
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
http2 on;
|
|
server_name DOMAIN_NAME;
|
|
|
|
# SSL certificates
|
|
ssl_certificate /etc/letsencrypt/live/DOMAIN_NAME/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/DOMAIN_NAME/privkey.pem;
|
|
|
|
# SSL configuration (Mozilla Modern)
|
|
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;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
# No OCSP stapling: Let's Encrypt no longer publishes an OCSP responder URL
|
|
# in its certificates, so ssl_stapling had nothing to staple and only
|
|
# produced a warning on every reload.
|
|
|
|
# Security headers
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
# Logging
|
|
access_log /var/log/nginx/pvemanager_access.log;
|
|
error_log /var/log/nginx/pvemanager_error.log;
|
|
|
|
# Rate limiting
|
|
limit_req zone=general burst=20 nodelay;
|
|
limit_conn addr 10;
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
proxy_pass http://pvemanager-app:8000;
|
|
access_log off;
|
|
}
|
|
|
|
# API proxy
|
|
location /api/ {
|
|
limit_req zone=api burst=50 nodelay;
|
|
proxy_pass http://pvemanager-app:8000;
|
|
proxy_http_version 1.1;
|
|
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;
|
|
}
|
|
|
|
# Proxmox API proxy
|
|
location /proxmox/ {
|
|
proxy_pass http://pvemanager-app:8000;
|
|
proxy_http_version 1.1;
|
|
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;
|
|
# Загрузка ISO/образов: файлы многогигабайтные, дефолтный
|
|
# client_max_body_size 100M и короткие таймауты им не подходят.
|
|
client_max_body_size 20g;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
client_body_timeout 3600s;
|
|
}
|
|
|
|
# WebSocket support — tasks и terminal
|
|
location ~ ^/(ws|proxmox/ws)/ {
|
|
proxy_pass http://pvemanager-app:8000;
|
|
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_read_timeout 86400;
|
|
proxy_send_timeout 86400;
|
|
}
|
|
|
|
# Backend static files (legacy, logo, etc.)
|
|
location /static/ {
|
|
proxy_pass http://pvemanager-app:8000;
|
|
proxy_cache_valid 200 1d;
|
|
expires 1d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# SPA frontend — all other routes
|
|
location / {
|
|
proxy_pass http://pvemanager-frontend:80;
|
|
proxy_http_version 1.1;
|
|
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;
|
|
}
|
|
}
|