图片服务器使用 Nginx 的 proxy_store 把主服务器的静态内容缓存到本地。一次访问结束后,以后的访问将直接在本地硬盘上读写。从而分担流量负载 server { include listen.conf; server_name ucenter.gznow.org; location ~ \.php$ { limit_conn one 20; limit_rate 50k; proxy_pass http://s1; include proxy.conf; } location / { expires max; root /data/nginx_cache/ucenter; proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /data/nginx_cache/ucenter; include proxy.conf; if ( !-e $request_filename) { proxy_pass http://s1; } } } ####################### ## 附 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; proxy_set_header Accept-Encoding 'gzip'; client_max_body_size 100m; client_body_buffer_size 256k; proxy_connect_timeout 60; proxy_send_timeout 60; proxy_read_timeout 60; proxy_buffer_size 512k; proxy_buffers 8 512k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 512k; (责任编辑:IT) |