caching - Why nginx does not cache my content? -
i checked cache path /usr/local/nginx/proxy_cache. no cache file found after visit url many times.
my configuration: ngnix.conf
http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; client_body_buffer_size 512k; proxy_temp_file_write_size 128k; proxy_temp_path /usr/local/nginx/proxy_temp; proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=content:20m inactive=1d max_size=100m; gzip on; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
default
server { listen 80; server_name 208.115.202.87; location /test { proxy_cache content; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid 200 15m; proxy_pass http://aaa.com/; }
nginx not cache pages sets cookies, check if pages have set-cookie
header.
if necessary, cookies can ignored proxy_ignore_headers , suppressed proxy_hide_header. example:
proxy_ignore_headers set-cookie; proxy_hide_header set-cookie;
Comments
Post a Comment