user www www; worker_processes 4; worker_rlimit_nofile 20480; error_log logs/error.log; events { use epoll; worker_connections 81920; } http { keepalive_timeout 10; ncache_max_size 24; proxy_buffering off; ncache_dir /data1/cache_file 60;#the file for storage,60G ncache_dir /data2/cache_file 60; hash_index_dir /data1/ncache_index;#v3.1,you need to define the index file position auto_delete_file on;#enable the auto delete file ncache_ignore_client_no_cache on; upstream backend { server 10.0.0.1; } sendfile on; send_timeout 10; client_header_timeout 10; tcp_nodelay on; log_format main '$proxy_add_x_forwarded_for - $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" $remote_addr'; include "mime.types"; default_type text/html; server { server_name .blog.sina.com.cn; listen *:80; set $xvia "blog.sina.com.cn"; set $proxy_add_agent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; NginxCache)"; access_log logs/blog.sina.com.cn-access_log main; location / { if ($request_method ~ "PURGE") { rewrite (.*) /PURGE$1 last; } ncache_http_cache; error_page 404 = /fetch$request_uri; add_header Sina-Cache $xvia; } location /ncache_state { ncache_state; } location /fetch { internal; proxy_pass http://backend; add_header Sina-Cache $xvia; proxy_hide_header User-Agent; proxy_set_header User-Agent $proxy_add_agent; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /PURGE/ { access_log logs/purge.blog.sina.com.cn-access_log main; internal; allow 10.55.37.0/24; allow 10.69.3.0/24; allow 10.49.10.0/24; deny all; ncache_purge; } } }