From 44f9351cdee4a259ad2f39280a114995ebc45d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D0=BB=D1=82=D0=BE=D0=B1=D0=B8=D0=BD=20=D0=95?= =?UTF-8?q?=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Fri, 24 Jan 2025 14:07:15 +0300 Subject: [PATCH] DEVOPS-1898 fixes from Pavel --- config/nginx.conf | 64 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/config/nginx.conf b/config/nginx.conf index d59724b0..85b7e6aa 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -17,6 +17,7 @@ http { sendfile on; server_tokens off; + gzip on; # text/html doesn't need to be defined there, it's compressed always @@ -34,7 +35,7 @@ http { server { listen 80 default; - access_log /var/log/nginx/access.log nginx_main; + access_log /var/log/nginx/access.log nginx_main; error_log /var/log/nginx/error.log error; charset utf-8; @@ -76,43 +77,44 @@ http { text/xml; location / { - root /frontend; - index index.html; - try_files $uri @index; + root /frontend; + index index.html; + try_files $uri @index; - add_header Content-Security-Policy "frame-ancestors 'none'; default-src 'self'; script-src 'self'; style-src 'unsafe-inline' 'self' data:; font-src 'self' data:; img-src 'self' data:;"; + add_header Content-Security-Policy "frame-ancestors 'none'; default-src 'self'; script-src 'self'; style-src 'unsafe-inline' 'self' data:; font-src 'self' data:; img-src 'self' data:;"; - #Application config - location = /src/resources/app-config.json { - add_header Cache-Control "no-cache"; - expires 0; - } - # Media: images, icons, video, audio, HTC - location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webm|htc|woff2|woff|ttf)$ { - expires 1M; - access_log off; - # max-age must be in seconds - add_header Cache-Control "max-age=2629746, public"; - } - # CSS and Javascript - location ~* \.(?:css|js)$ { - expires 1y; - access_log off; - add_header Cache-Control "max-age=31556952, public"; - } - } + #Application config + location = /src/resources/app-config.json { + add_header Cache-Control "no-cache"; + expires 0; + } + # Media: images, icons, video, audio, HTC + location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webm|htc|woff2|woff|ttf)$ { + expires 1M; + access_log off; + # max-age must be in seconds + add_header Cache-Control "max-age=2629746, public"; + } + # CSS and Javascript + location ~* \.(?:css|js)$ { + expires 1y; + access_log off; + add_header Cache-Control "max-age=31556952, public"; + } + } location @index { - root /frontend; - add_header Cache-Control "no-cache"; - expires 0; - try_files /index.html =404; + root /frontend; + add_header Cache-Control "no-cache"; + add_header Content-Security-Policy "frame-ancestors 'none'; default-src 'self'; script-src 'self'; style-src 'unsafe-inline' 'self' data:; font-src 'self' data:; img-src 'self' data:;"; + expires 0; + try_files /index.html =404; } location = /health { - access_log off; - add_header 'Content-Type' 'application/json'; - return 200 '{"status":"UP"}'; + access_log off; + add_header 'Content-Type' 'application/json'; + return 200 '{"status":"UP"}'; } } }