请问nginx的一个关于缓存的问题
请问我想用nginx把一些文件缓存到本地,想用nginx的proxy_store on的功能。。可是试了无数次了,设置的 /data/nginx_cache/a/proxy_temps里面就是没东西,参数也加了n多了。。。。。。哪位高手帮我看看,我是什么地方设的不对吗?还是缓存的生成有条件?location / {
limit_rate 300k;
indexindex.php index.html index.htm;
proxy_pass http://zixun;
root /usr/local/tomcatzx/webapps/a;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 10;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_store on;
proxy_store_access user:rwgroup:rwall:rw;
expires 2d;
client_body_temp_path/data/nginx_cache/a/client_body;
proxy_temp_path /data/nginx_cache/a/proxy_temp;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|htm|css)$ {
expires 1h;
root /data/nginx_cache/a/proxy_temp;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
proxy_max_temp_file_size 128m;
proxy_store on;
proxy_store_access user:rwgroup:rwall:rw;
client_body_temp_path/data/nginx_cache/a/client_body;
proxy_temp_path /data/nginx_cache/a/proxy_temps;
if ( !-e $request_filename){
proxy_pass http://zixun;
}
}
刚才同事删掉了原来设置的一个缓存目录的东西,proxy_temp_path /data/nginx_cache/a/proxy_temps下面就有东西了?这个proxy store 的生成条件是什么呢 我现在在缓存目录里面找了个图片,比如是a.jpg,我把它内容改成了其他的,名字还是a.jpg reload了nginx过了一会网页里应该显示a.jpg的图果然变了。我想把他变回来,就删了缓存里面的a.jpg,看配置里面文件不存在应该转到后端去的,可是还是一直显示变了后的a.jpg。这是怎么回事啊。 本帖最后由 action08 于 2014-07-27 21:35 编辑
nginx高科技的呀 本帖最后由 action08 于 2014-07-27 21:45 编辑
proxy_temp_path /data/nginx_cache/a/proxy_temps;
查了一下手册,这个指令只是临时文件的,你应该明确使用proxy_store,或者alias
It is thus recommended that for any given location both saved files and a directory holding temporary files, set by the proxy_temp_path directive, are put on the same file system.
页:
[1]