Nginx反向代理缓存Proxy Cache配置文件范例
  • 下面是本站的Nginx反向代理缓存Proxy Cache配置文件范例,仅供各位站长参考,源站点在美国,用日本的vps做Nginx代理缓存测试,实际测试效果不错. 要注意proxy_temp_path和proxy_cache_path目录本身和上级目录都要有相应权限,不然就会有生成缓存文件失败的权限错误提示. 如果需要重新生成缓存,直接把缓存目录里面的子目录都删除就可以了.

    proxy_temp_path   /home/654z/proxy_temp_dir 1 2;
    proxy_cache_path /home/654z/proxy_cache_dir levels=1:2 keys_zone=654z:50m inactive=1d max_size=30g;

    server  {
            listen          210.175.52.111:80;
            server_name     www.654z.com .654z.com;

            location / {
                    proxy_pass http://654z.com/;
                    proxy_redirect          off;
                    proxy_set_header        X-Real-IP       $remote_addr;
                    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header        Host            $host;

                    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;

                    client_max_body_size       10m;
                    client_body_buffer_size    128k;

                    proxy_connect_timeout      90;
                    proxy_send_timeout         90;
                    proxy_read_timeout         90;

                    proxy_cache 654z;
                    proxy_cache_valid 200 302 12h;
                    proxy_cache_valid 301 1d;
                    proxy_cache_valid any 1h;

                    proxy_buffer_size          4k;
                    proxy_buffers              4 32k;
                    proxy_busy_buffers_size    64k;
                    proxy_temp_file_write_size 64k;
            }
    }

  •  

  • 点这里复制本页地址发送给您QQ/MSN上的好友
  • 300*300广告