Opened 5 years ago

Closed 5 years ago

#849 closed defect (worksforme)

proxy_cache filder no files,I think it is a bug,because in version 1.0.4 is OK!

Reported by: Art-Man@… Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.9.x
Keywords: proxy_cache Cc: liaodengsong@…
uname -a: Linux S001 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.9.6
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-threads --with-stream --with-stream_ssl_module --with-http_v2_module

Description

proxy_cache filder no file,Other works will

config:
##==temp&Cache=======
proxy_temp_path /var/cache/nginx/proxy_temp;
proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=1g;

location ~*/ynedut/.*\.(gif|jpg|jpeg|png|ico|css|js|swf|txt|mp3)$
{

include cache.conf;
expires 30d;

proxy_cache_key $host$uri$is_args$args;
proxy_set_header Host $host;
proxy_cache cache_one;

proxy_pass http://ynedut;
break;

}
location ~*/ynedut/.*\.(htm|html)$
{

include cache.conf;
expires 2m;

proxy_cache_key $host$uri$is_args$args;
proxy_set_header Host $host;
proxy_cache cache_one;

proxy_pass http://ynedut;

break;

}
location /ynedut/{
proxy_pass http://ynedut;
include proxy.conf;
}

Attachments (1)

nginx.zip (14.8 KB ) - added by Art-Man@… 5 years ago.

Download all attachments as: .zip

Change History (2)

by Art-Man@…, 5 years ago

Attachment: nginx.zip added

comment:1 by Maxim Dounin, 5 years ago

Resolution: worksforme
Status: newclosed

Consider looking carefully at your backend responses. Most common problems include:

  • responses with Set-Cookie header are not cached by nginx by default;
  • there are various headers which can control or disable caching: Cache-Control, Expires, X-Accel-Expires, Vary;
  • if no headers explicitly enable caching (Cache-Control, Expires), then proxy_cache_valid directives will be used, and nginx won't cache the response if there are no proxy_cache_valid directives defined as in your configuration;
  • incorrect permissions on a cache path or proxy temp path (or any path component) can easily cause errors;
  • switched off proxy_buffering will disable caching.

Some additional information can be found in the documentation, see proxy_ignore_headers and proxy_cache_valid.

Note well that number of default cache policies has been changed since nginx 1.0.1, in particular nginx no longer caches responses with Vary: *, and Cache-Control: s-maxage now properly handled. Full list of changes can be found in the CHANGES file.

See also A debugging log article to find out how to see request processing details, including a backend response, in nginx logs. Please also see support page for a list of proper places to ask for help if something goes wrong.

Note: See TracTickets for help on using tickets.