Update nginx.conf with new gzip and caching settings

This commit is contained in:
Max Schmidt 2023-10-24 10:01:24 +02:00
parent 07a19d407e
commit 496702f2ab

View File

@ -10,10 +10,11 @@ http {
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
default_type application/octet-stream;
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
@ -23,13 +24,19 @@ http {
internal;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|htm|html)$ {
root /usr/share/nginx/html;
expires 30d;
location ~* \.(jpg|jpeg|png|gif|ico|css|html)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
location ~* \.js$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
add_header Content-Type application/javascript;
}
error_page 404 /index.html;
}
}