I have a server configured to proxy by setting:

proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=backcache:8m max_size=20g inactive=7d;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";

Despite this, when I start nginx, I end up with /var/lib/nginx/proxy as well. BOTH started filling up and eventually the hard drive filled up.

If I try making my proxy_cache_path point to /var/lib/nginx/proxy instead, I get the error:

nginx: [emerg] the same path name "/var/lib/nginx/proxy" used in /etc/nginx/conf.d/proxy.conf:1 and in /etc/nginx/nginx.conf:62
nginx: configuration file /etc/nginx/nginx.conf test failed

Line 62 of nginx.conf is just the end of the http{} section, so I assume this is complaining about the "default" that I'm attempting to override.

I can't figure out how to disable this proxy config which appears to be duplicating the explicit config I've set up. Is there a way to override/remove that default proxy configuration?


Turns out the issue was that /var/lib/nginx/proxy is the proxy_temp_path. Normally nginx will download to this temp path and then move the files over to the real cache directory once they've finished downloading.

We must have had a lot of things that didn't finish downloading, or never made it over into the main cache, so the disk filled up.

The solution in this case was to just turn use of the temp_path off (with the use_temp_path=off parameter on the proxy_cache_path directive on nginx 1.7.10 or higher).

  • To add on, you have to manually delete those files/directories in /var/lib/nginx/proxy a well placed rm -rf should do it. – Abhishek Dujari Jan 20 '18 at 20:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.