nginx的proxy_cache怎么配的??老出错
nginx.conf
http{
...
proxy_temp_path /data/proxy_temp_path
proxy_cache_path /data/proxy_cache_path levels=1:2 key_zone=cache_one:200m inactive=1d max_size=1g
## /data/proxy_temp_path/data/proxy_cache_path都存在。
}
default.conf
server {
location / {
...
proxy_cache cache_one; #使用cache_one这个keys_zone
proxy_cache_valid 200 301 302 1d; #200,301,302状态码保存1小时
proxy_cache_valid any 1h; #其它的保存一小时
}
location ~ .*\.(gif|jpg|png|txt|htm|html|css|js|flv|ico|swf)(.*) {
expires 6h; #设置浏览器过期时间
proxy_redirect off;
proxy_set_header Host $host;
proxy_cache cache_one;
proxy_cache_valid 200 301 302 1d;
proxy_cache_valid any 1d;
expires 30d;
}
}
[[email protected] nginx]# service nginx restart
nginx: [emerg] invalid number of arguments in "proxy_temp_path" directive in /etc/nginx/nginx.conf:39
nginx: configuration file /etc/nginx/nginx.conf test failed