我檢查了緩存路徑/ usr/local/nginx/proxy_cache。我多次訪問某個網址後沒有找到緩存文件。爲什麼nginx不會緩存我的內容?
我的配置: 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/*;
}
默認
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/;
}
你可以指出任何支持這種情況的文檔嗎? – 2013-10-25 21:04:05
http://wiki.nginx.org/HttpProxyModule#proxy_cache 下面的響應報頭標誌作爲不可緩存的響應,除非它們被忽略: 的Set-Cookie含「無緩存」,「無店」 緩存控制,「私人」或帶有非數字或0值的「最大年齡」 過去的時間到期 X-Accel-Expires:0 – digitalPBK 2013-10-26 03:13:20