Nginx笔记总结十五:nginx+keepalive+proxy_cache配置高可用nginx集群和高速缓存
nginx编译 wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz ./configure --prefix=/usr/local/nginx --add-module=../ngx_cache_purge-2.3 --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module 配置: proxy_cache_path /data/proxy_cache_dir levels=1:2 keys_zone=cache_one:50m inactive=1m max_size=2g; upstream real_server_pool { server 192.168.200.148:80 weight=1 max_fails=2 fail_timeout=30s; server 192.168.200.149:80 weight=1 max_fails=2 fail_timeout=30s; } service { listen 80; server_name localhost; location / { root html; index index.html index.htm; proxy_next_upstream http_502 http_504 wror timeout invalid_header; proxy_cache cache_one; procy_cache_valid 200 304 12h; proxy_cache_key $host$uri$is_args$args; proxy_set_header Host $host; prox_set_hreader X-Forwarded-For $remote_addr; proxy_pass http://real_server_pool; expires 1d; } }