mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-07-27 15:45:21 +00:00
49 lines
1.5 KiB
Nginx Configuration File
49 lines
1.5 KiB
Nginx Configuration File
![]() |
events {
|
||
|
worker_connections 1024;
|
||
|
}
|
||
|
|
||
|
http {
|
||
|
include /etc/nginx/mime.types;
|
||
|
default_type application/octet-stream;
|
||
|
|
||
|
# Gzip compression
|
||
|
gzip on;
|
||
|
gzip_vary on;
|
||
|
gzip_min_length 1024;
|
||
|
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
|
||
|
|
||
|
server {
|
||
|
listen 80;
|
||
|
server_name _;
|
||
|
root /usr/share/nginx/html;
|
||
|
index index.html index.htm;
|
||
|
|
||
|
# Handle client-side routing - support subpaths
|
||
|
location / {
|
||
|
try_files $uri $uri/ /index.html;
|
||
|
}
|
||
|
|
||
|
# Proxy API calls to backend
|
||
|
location /api/ {
|
||
|
proxy_pass ${BACKEND_URL}/api/;
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
# Cache static assets
|
||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||
|
expires 1y;
|
||
|
add_header Cache-Control "public, immutable";
|
||
|
}
|
||
|
|
||
|
# Security headers
|
||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
|
add_header X-Content-Type-Options "nosniff" always;
|
||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
}
|
||
|
}
|