标签:http io os ar 使用 for sp on log
安装时添加 ngx_cache_purge 模块
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=ngx_cache_purge-2.1
vi nginx.conf
proxy_temp_path /home/nginx/temp; proxy_cache_path /home/nginx/cache levels=1:2 keys_zone=cache_one:2000m inactive=24h max_size=80g;
vi proxy.conf
proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header; proxy_connect_timeout 300s; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 32k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_redirect off; proxy_hide_header Vary; proxy_set_header Accept-Encoding ‘‘; proxy_set_header Host $host; proxy_set_header Referer $http_referer; proxy_set_header Cookie $http_cookie; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_intercept_errors on; proxy_redirect default;其中
proxy_intercept_errors on; proxy_redirect default;
用于503错误时使用自定义页面
vi vhost/domain.conf
upstream test_server { server 192.168.130.54 max_fails=3 fail_timeout=5s; server 192.168.130.57 max_fails=3 fail_timeout=5s; server 192.168.130.51 backup; } server { listen 80; server_name test.pc6.com; location /test/ { proxy_cache cache_one; proxy_cache_valid 200 304 1d; proxy_ignore_headers cache-control; proxy_cache_key $host$uri$is_args$args; include proxy.conf; proxy_pass http://test_server; expires 1d; access_log /home/wwwlogs/test.log log; } location ~ /jfclear(/.*) { #allow 127.0.0.1; allow all; deny all; proxy_cache_purge cache_one $host$1$is_args$args; } error_page 503 /50x.html; location = /50x.html { root /home/html; } }其中
proxy_ignore_headers cache-control;用于强制缓存动态页面
标签:http io os ar 使用 for sp on log
原文地址:http://my.oschina.net/u/937746/blog/339866