|
@@ -6,10 +6,42 @@ server {
|
|
|
|
|
|
|
|
# Gzip Compression
|
|
# Gzip Compression
|
|
|
gzip on;
|
|
gzip on;
|
|
|
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
|
|
|
+ gzip_static on;
|
|
|
|
|
+ gzip_vary on;
|
|
|
|
|
+ gzip_proxied any;
|
|
|
|
|
+ gzip_comp_level 6;
|
|
|
|
|
+ gzip_buffers 16 8k;
|
|
|
|
|
+ gzip_http_version 1.1;
|
|
|
|
|
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml font/woff2;
|
|
|
|
|
+
|
|
|
|
|
+ # Security Headers
|
|
|
|
|
+ add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
|
+ add_header X-XSS-Protection "1; mode=block";
|
|
|
|
|
+ add_header X-Content-Type-Options "nosniff";
|
|
|
|
|
+ add_header Referrer-Policy "strict-origin-when-cross-origin";
|
|
|
|
|
+ # add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
|
|
|
|
|
|
|
|
location / {
|
|
location / {
|
|
|
try_files $uri $uri/ /index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
+
|
|
|
|
|
+ # Caching for index.html (don't cache)
|
|
|
|
|
+ location = /index.html {
|
|
|
|
|
+ add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ # Static assets in /assets/ (Vite)
|
|
|
|
|
+ location /assets/ {
|
|
|
|
|
+ expires 1y;
|
|
|
|
|
+ add_header Cache-Control "public, immutable";
|
|
|
|
|
+ access_log off;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ # Other static files
|
|
|
|
|
+ location ~* \.(?:ico|gif|jpe?g|png|woff2?|eot|otf|ttf|svg|webp|avif)$ {
|
|
|
|
|
+ expires 7d;
|
|
|
|
|
+ add_header Cache-Control "public";
|
|
|
|
|
+ access_log off;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
# Proxy API requests to backend
|
|
# Proxy API requests to backend
|
|
@@ -17,6 +49,8 @@ server {
|
|
|
proxy_pass http://127.0.0.1:8000/;
|
|
proxy_pass http://127.0.0.1:8000/;
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Host $host;
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
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;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
# Standalone Deploy Webhook
|
|
# Standalone Deploy Webhook
|
|
@@ -32,12 +66,13 @@ server {
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
proxy_set_header Connection "Upgrade";
|
|
proxy_set_header Connection "Upgrade";
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header Host $host;
|
|
|
|
|
+ proxy_read_timeout 86400;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
# Static uploads
|
|
# Static uploads
|
|
|
location /uploads/ {
|
|
location /uploads/ {
|
|
|
alias /var/www/radionica3d/backend/uploads/;
|
|
alias /var/www/radionica3d/backend/uploads/;
|
|
|
- expires 7d;
|
|
|
|
|
|
|
+ expires 30d;
|
|
|
add_header Cache-Control "public";
|
|
add_header Cache-Control "public";
|
|
|
}
|
|
}
|
|
|
|
|
|