From 73dd2877ba89b7688e72f3e775d69fee355b211c Mon Sep 17 00:00:00 2001 From: MoonTestUse1 Date: Wed, 25 Dec 2024 23:07:14 +0600 Subject: [PATCH] 21:43 --- docker/nginx/conf.d/default.conf | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf index 28b70a7..495fb77 100644 --- a/docker/nginx/conf.d/default.conf +++ b/docker/nginx/conf.d/default.conf @@ -1,14 +1,14 @@ server { - listen 80; + listen 80 default_server; server_name _; root /usr/share/nginx/html; index index.html; - # Отключаем автоиндексацию для продакшена + # Отключаем автоиндексацию autoindex off; - # Основной location для всех маршрутов + # Основной location для SPA location / { try_files $uri $uri/ /index.html; add_header Cache-Control "no-cache"; @@ -16,7 +16,7 @@ server { # API requests location /api/ { - proxy_pass http://backend:8000/; + proxy_pass http://backend:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -27,16 +27,13 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - # Static files caching + # Static files location /assets/ { + alias /usr/share/nginx/html/assets/; expires 1y; add_header Cache-Control "public, no-transform"; - try_files $uri $uri/ =404; } - # Prevent access to . files - location ~ /\. { - deny all; - } + # Обработка ошибок + error_page 404 /index.html; } -