73 lines
2.5 KiB
Text
73 lines
2.5 KiB
Text
|
|
# Sözsoft Platform UI konteyneri (nginx).
|
|||
|
|
#
|
|||
|
|
# Hash'li chunk'lar `/srv/assets` altından servis edilir: imajın `dist/assets` içeriği +
|
|||
|
|
# önceki sürümlerin arşivi (bkz. nginx/40-archive-assets.sh). Deploy sonrası açık sekmeler
|
|||
|
|
# kendi sürümlerinin chunk'larını bulmaya devam eder; "eksik js" hatası oluşmaz.
|
|||
|
|
#
|
|||
|
|
# Sürüm kapısı olan dosyalar (index.html, sw.js, warmup.json, manifest) her istekte sunucudan
|
|||
|
|
# doğrulanır; hash'li dosyalar bir yıl değişmez kabul edilir. `${API_URL}` build sırasında
|
|||
|
|
# `.env.{ENV}` dosyasındaki VITE_API_URL ile doldurulur (Dockerfile).
|
|||
|
|
server {
|
|||
|
|
listen 80;
|
|||
|
|
server_name _;
|
|||
|
|
root /usr/share/nginx/html;
|
|||
|
|
index index.html;
|
|||
|
|
|
|||
|
|
gzip on;
|
|||
|
|
gzip_vary on;
|
|||
|
|
gzip_min_length 1024;
|
|||
|
|
gzip_types text/css application/javascript application/json application/manifest+json image/svg+xml text/plain application/wasm;
|
|||
|
|
|
|||
|
|
# Hash'li dosyalar: ad değişmeden içerik değişmez.
|
|||
|
|
location /assets/ {
|
|||
|
|
root /srv;
|
|||
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|||
|
|
try_files $uri =404;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Sürüm kapısı: tarayıcı ve service worker bu dosyaları her zaman sunucudan alır.
|
|||
|
|
location = /index.html {
|
|||
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location = /sw.js {
|
|||
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location = /warmup.json {
|
|||
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location = /manifest.webmanifest {
|
|||
|
|
# nginx'in mime.types dosyasında .webmanifest yoktur; tarayıcı doğru tipi ister.
|
|||
|
|
types { application/manifest+json webmanifest; }
|
|||
|
|
add_header Cache-Control "no-store, no-cache, must-revalidate";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# DevExtreme temaları hash'sizdir; service worker stale-while-revalidate ile tazeler.
|
|||
|
|
location /css/ {
|
|||
|
|
add_header Cache-Control "public, max-age=86400";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location /img/ {
|
|||
|
|
add_header Cache-Control "public, max-age=604800";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Arama motoru dosyaları API tarafından üretilir (SeoController); sitenin kökünden yayınlanır.
|
|||
|
|
location = /sitemap.xml {
|
|||
|
|
proxy_pass ${API_URL}/sitemap.xml;
|
|||
|
|
proxy_ssl_server_name on;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location = /robots.txt {
|
|||
|
|
proxy_pass ${API_URL}/robots.txt;
|
|||
|
|
proxy_ssl_server_name on;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# SPA: fiziksel dosya yoksa index.html (iç yönlendirme `= /index.html` bloğuna düşer,
|
|||
|
|
# no-store başlıkları oradan gelir).
|
|||
|
|
location / {
|
|||
|
|
try_files $uri /index.html;
|
|||
|
|
}
|
|||
|
|
}
|