You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.4 KiB
64 lines
2.4 KiB
# پیکربندی nginx برای داشبورد SPA.
|
|
#
|
|
# این یک template است: nginx رسمی هنگام استارت با envsubst فقط ${BACKEND_UPSTREAM}
|
|
# را جایگزین میکند و خروجی را در /etc/nginx/conf.d/default.conf مینویسد.
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# فشردهسازی متن/اسکریپت/استایل/SVG
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
|
|
# ── healthcheck سبک (بدون لاگ) ──
|
|
location = /healthz {
|
|
access_log off;
|
|
add_header Content-Type text/plain;
|
|
return 200 'ok';
|
|
}
|
|
|
|
# ── پراکسیِ API → بکاند (${BACKEND_UPSTREAM}) ──
|
|
location /api/ {
|
|
proxy_pass http://${BACKEND_UPSTREAM};
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host panel.zainabiyatours.com;
|
|
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;
|
|
|
|
# پشتیبانی از WebSocket/upgrade
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 300s;
|
|
}
|
|
|
|
# ── پیکربندی runtime: همیشه تازه (تا تغییر env بدون کش اعمال شود) ──
|
|
location = /config.js {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
try_files /config.js =404;
|
|
}
|
|
|
|
# ── shell اپ: کش نشود تا دیپلوی جدید فوراً دیده شود ──
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
|
|
# ── داراییهای هشدار: کش طولانیمدت و immutable ──
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# ── SPA fallback: هر مسیر ناشناخته به index.html (روتینگ سمت کلاینت) ──
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|