diff --git a/nginx.conf b/nginx.conf index 058db40..e9ec4fb 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,4 +1,5 @@ load_module modules/ngx_http_brotli_static_module.so; +load_module modules/ngx_http_brotli_filter_module.so; user nginx; worker_processes auto; @@ -20,7 +21,7 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - access_log /var/log/nginx/access.log main; + access_log /dev/stdout main; sendfile on; @@ -51,25 +52,34 @@ http { location / { root /usr/share/nginx/html; - index index; + index /index.html; gzip_static on; brotli_static on; error_page 500 502 503 504 /err/50x.html; - error_page 404 /err/404; - try_files $uri.html $uri $uri/index.html $uri/ =404; + try_files $uri $uri/ /index.html; add_header Cache-Control "public, no-transform, max-age=1209600"; - if ($uri ~* \.html$) { - return 404; - } + rewrite ^([^.]*[^/])$ $1/ permanent; } location /misc/ { proxy_pass http://backend; + brotli on; + brotli_comp_level 6; + brotli_types *; + gzip on; + gzip_comp_level 6; + gzip_types *; } location /api/ { proxy_pass http://backend; + brotli on; + brotli_comp_level 6; + brotli_types *; + gzip on; + gzip_comp_level 6; + gzip_types *; proxy_cache_key $scheme://$host$uri$is_args$query_string; proxy_ignore_headers Cache-Control; proxy_cache_valid 200 2m; # Evaluate whether 2m or 1m is more appropriate