1 1.1 mrg proxy_cache_path /var/cache/nginx/ levels=1:2 keys_zone=my_cache:10m max_size=24g inactive=48h use_temp_path=off; 2 1.1 mrg 3 1.1 mrg server { 4 1.1 mrg listen 10.42.0.1:8888 default_server; 5 1.1 mrg listen 127.0.0.1:8888 default_server; 6 1.1 mrg listen [::]:8888 default_server; 7 1.1 mrg resolver 8.8.8.8; 8 1.1 mrg 9 1.1 mrg root /var/www/html; 10 1.1 mrg 11 1.1 mrg # Add index.php to the list if you are using PHP 12 1.1 mrg index index.html index.htm index.nginx-debian.html; 13 1.1 mrg 14 1.1 mrg server_name _; 15 1.1 mrg 16 1.1 mrg add_header X-GG-Cache-Status $upstream_cache_status; 17 1.1 mrg proxy_cache my_cache; 18 1.1 mrg 19 1.1 mrg location /cache_gitlab_artifacts { 20 1.1 mrg internal; 21 1.1 mrg # Gitlabs http server puts everything as no-cache even though 22 1.1 mrg # the artifacts URLS don't change. So enforce a long validity 23 1.1 mrg # time and ignore the headers that defeat caching 24 1.1 mrg proxy_cache_valid 200 48h; 25 1.1 mrg proxy_ignore_headers Cache-Control Set-Cookie; 26 1.1 mrg include snippets/uri-caching.conf; 27 1.1 mrg } 28 1.1 mrg 29 1.1 mrg location /cache { 30 1.1 mrg # special case gitlab artifacts 31 1.1 mrg if ($arg_uri ~* /.*gitlab.*artifacts(\/|%2F)raw/ ) { 32 1.1 mrg rewrite ^ /cache_gitlab_artifacts; 33 1.1 mrg } 34 1.1 mrg # Set a really low validity together with cache revalidation; Our goal 35 1.1 mrg # for caching isn't to lower the number of http requests but to 36 1.1 mrg # lower the amount of data transfer. Also for some test 37 1.1 mrg # scenarios (typical manual tests) the file at a given url 38 1.1 mrg # might get modified so avoid confusion by ensuring 39 1.1 mrg # revalidations happens often. 40 1.1 mrg proxy_cache_valid 200 10s; 41 1.1 mrg proxy_cache_revalidate on; 42 1.1 mrg include snippets/uri-caching.conf; 43 1.1 mrg } 44 1.1 mrg } 45