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