DEVOPS-1892 nginx.conf grooming

This commit is contained in:
Pavel Zilke 2025-01-14 10:25:30 +03:00
parent 08572b35fa
commit 45f7e2db8b

View file

@ -33,7 +33,7 @@ http {
server { server {
listen 80 default; 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; error_log /var/log/nginx/error.log error;
charset utf-8; charset utf-8;
@ -55,8 +55,8 @@ http {
gzip_min_length 256; gzip_min_length 256;
gzip_types gzip_types
application/atom+xml application/atom+xml
application/geo+json application/geo+json
application/javascript application/javascript
application/x-javascript application/x-javascript
application/json application/json
application/ld+json application/ld+json
@ -75,36 +75,41 @@ http {
text/xml; text/xml;
location / { location / {
root /frontend; root /frontend;
index index.html; index index.html;
try_files $uri @index; try_files $uri @index;
# Media: images, icons, video, audio, HTC #Application config
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|mp3|ogg|ogv|webm|htc|woff2|woff|ttf)$ { location = /src/resources/app-config.json {
expires 1M; add_header Cache-Control "no-cache";
access_log off; expires 0;
# max-age must be in seconds }
add_header Cache-Control "max-age=2629746, public"; # 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)$ {
# CSS and Javascript expires 1M;
location ~* \.(?:css|js)$ { access_log off;
expires 1y; # max-age must be in seconds
access_log off; add_header Cache-Control "max-age=2629746, public";
add_header Cache-Control "max-age=31556952, public"; }
} # CSS and Javascript
} location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "max-age=31556952, public";
}
}
location @index { location @index {
root /frontend; root /frontend;
add_header Cache-Control no-cache; add_header Cache-Control "no-cache";
expires 0; expires 0;
try_files /index.html =404; try_files /index.html =404;
} }
location = /health { location = /health {
access_log off; access_log off;
add_header 'Content-Type' 'application/json'; add_header 'Content-Type' 'application/json';
return 200 '{"status":"UP"}'; return 200 '{"status":"UP"}';
} }
} }
} }