53 lines
1.6 KiB
Plaintext
53 lines
1.6 KiB
Plaintext
server {
|
|
listen 8080;
|
|
server_name localhost;
|
|
|
|
# Set maximum upload size
|
|
client_max_body_size 300M;
|
|
|
|
# Add security headers
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
add_header X-Frame-Options SAMEORIGIN;
|
|
add_header Referrer-Policy strict-origin-when-cross-origin;
|
|
|
|
# Main location for Grist
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8484;
|
|
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_read_timeout 90;
|
|
proxy_buffering off;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location = /healthz {
|
|
access_log off;
|
|
add_header Content-Type text/plain;
|
|
return 200 'OK';
|
|
}
|
|
|
|
# Static file caching
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
|
proxy_pass http://127.0.0.1:8484;
|
|
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;
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
# Error pages
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
} |