Добавьте файлы проекта.
This commit is contained in:
55
PlaylistShared.Pwa/nginx.conf
Normal file
55
PlaylistShared.Pwa/nginx.conf
Normal file
@@ -0,0 +1,55 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Сжатие
|
||||
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/wasm application/json;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Для Service Worker – запрещаем кэширование, чтобы он всегда был свежим
|
||||
location = /service-worker.js {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Для файла манифеста Service Worker assets – тоже не кэшируем
|
||||
location = /service-worker-assets.js {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Expires "0";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Основной SPA fallback: все неизвестные пути отдаём через index.html
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html?$args;
|
||||
}
|
||||
|
||||
# Кэширование статических ресурсов (css, js, изображения, шрифты)
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Для .wasm файлов – правильный MIME‑тип и кэширование
|
||||
location ~* \.wasm$ {
|
||||
default_type application/wasm;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user