diff --git a/nginx.conf b/nginx.conf index e93c871..0519a45 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,4 +1,4 @@ -proxy_cache_path /var/nginx/cache keys_zone=mycache:10m; +proxy_cache_path /var/nginx/cache keys_zone=default_cache:10m max_size=2g; server { listen 8080; listen [::]:8080; @@ -7,12 +7,22 @@ server { server_name localhost; - proxy_cache mycache; + proxy_cache default_cache; + proxy_cache_key $scheme$proxy_host$uri; - proxy_ignore_headers "Set-Cookie"; - proxy_hide_header "Set-Cookie"; + proxy_buffering on; - proxy_cache_key $scheme$proxy_host$uri; + proxy_ignore_headers Expires; + proxy_ignore_headers X-Accel-Expires; + proxy_ignore_headers Cache-Control; + proxy_ignore_headers Set-Cookie; + + proxy_hide_header X-Accel-Expires; + proxy_hide_header Expires; + proxy_hide_header Cache-Control; + proxy_hide_header Pragma; + + add_header X-Proxy-Cache $upstream_cache_status; location = /health { access_log off; @@ -24,41 +34,24 @@ server { return 302 /public; } - location /login { - return 404; - } - - location /register { - return 404; - } - - location /jury { + location ~ ^/(login|register|jury|team) { return 404; } - location /team { - return 404; - } - - location /images { - proxy_cache_valid any 10m; - proxy_pass ${DOMJUDGE_URL}/images; - } - - location /flags { + location ~ ^/((images|flags|css|js|style_domjudge.css|webfonts|favicon.ico).*) { proxy_cache_valid any 10m; - proxy_pass ${DOMJUDGE_URL}/flags; + proxy_pass ${DOMJUDGE_URL}/$1; } location / { - proxy_set_header Accept-Encoding ""; - sub_filter '\n' ''; sub_filter ' Login\n' ''; sub_filter_once off; set $args $args&static=yes; + proxy_set_header Accept-Encoding ""; + proxy_cache_valid any 1m; proxy_pass ${DOMJUDGE_URL}; }