当前位置: > Linux服务器 > nginx >

nginx缓存配置实例

时间:2014-11-22 00:39来源:linux.it.net.cn 作者:IT


以下配置摘自OSChina.Net官方网站的联通节点配置

 

#缓存存放路径
proxy_cache_path /disk2/cache/data levels=1:2 keys_zone=static:1000m inactive=600m max_size=100G;
proxy_temp_path /disk2/cache/temp;

location ~ ^/(img|css|js|uploads)/ {
proxy_buffering on;
proxy_cache static;
proxy_cache_key "$host$request_uri$is_args$args";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_min_uses 1;
proxy_cache_valid 200 302 304 5m;
proxy_cache_use_stale http_502 http_503 http_504;
proxy_hide_header Set-Cookie;

proxy_pass  http://xxx.xxx.xxx.xxx;
include proxy.conf;
}
proxy.conf配置

 

 

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    10m;
client_body_buffer_size 128k;
proxy_connect_timeout   300;
proxy_send_timeout      300;
proxy_read_timeout      300;
proxy_buffer_size       4k;
proxy_buffers           4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
gzip.conf配置

 

 

gzip  			on;
gzip_min_length  	1000;
gzip_types 		text/plain text/css application/x-javascript; 



(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容