-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
43 lines (36 loc) · 1.22 KB
/
Copy pathnginx.conf
File metadata and controls
43 lines (36 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
server {
listen 80;
server_name _; # Traefik host başlığına göre yönlendirir, burada wildcard bırakıyoruz.
# ---- Güvenli default'lar ----
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header Referrer-Policy strict-origin-when-cross-origin;
add_header X-XSS-Protection "1; mode=block";
# ---- Gzip (nginx:alpine'da varsayılan modül mevcut) ----
gzip on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
# ---- Statik dosyalar için agresif cache ----
location ~* \.(?:js|mjs|css|svg|ico|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
# Vite/prod build fingerprint (hash) içerdiği için long cache güvenli
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# ---- index.html gibi kök dosyalar: kısa cache ----
location = /index.html {
expires -1;
add_header Cache-Control "no-store";
}
# ---- Healthcheck ----
location = /health {
add_header Content-Type text/plain;
return 200 "ok";
}
# ---- SPA fallback ----
location / {
try_files $uri /index.html;
}
root /usr/share/nginx/html;
}