Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/50549921
Problem:
Open the site management system, found that the picture display is very slow, look at the Nginx front-end agent detected:
[ERROR] 28423#0: Failed Connect () (111:connection refused) while connecting to upstream
Open the VPN, directly with the background server's IP address to access, found that the speed is quite fast, so suspect is a proxy server configuration problems.
When downloading a large attachment, or a large picture on the page, it will download the interrupt or the chart can not be displayed maybe you want to say I use the Nginx default settings do not encounter this problem, it is because your site does not have large files.
Copy the code code as follows:
location/mypm {root/home/mypmcc/mypm20100914; index index.jhtml index.html login_page.jhtml; proxy_set_header X-real-ip $remote _addr; Proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080; client_max_body_size 100m; client_body_ Buffer_size 128k; proxy_connect_timeout; proxy_read_timeout; proxy_send_timeout 6000; Proxy_buffer_size 32k; proxy_buffers4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 512k;}
NGINX Reverse Proxy parameter description
Proxy_connect_timeout 600; #nginx跟后端服务器连接超时时间 (proxy connection timed out)
Proxy_read_timeout 600; #连接成功后, back-end server response time (proxy receive timeout) Linux Learning, HTTP //linux.it.net.cn
Proxy_send_timeout 600; #后端服务器数据回传时间 (proxy send timeout)
Proxy_buffer_size 32k; #设置代理服务器 (nginx) buffer size for saving user header information
Proxy_buffers 4 32k; #proxy_buffers缓冲区, the average web page is below 32k, so set
Proxy_busy_buffers_size 64k; #高负荷下缓冲大小 (proxy_buffers*2)
Proxy_temp_file_write_size 64k; #设定缓存文件夹大小, greater than this value, will be passed from the upstream server
Proxy_temp_file_write_size 64k; My picture is more than 200 k, hey!
The problem is on the proxy_temp_file_write_size, when your file exceeds the size of the parameter setting, Nginx will first write the file to a temporary directory (the default is Nginx install the/proxy_temp directory), or directly change Proxy_temp_ The value of the file_write_size.
The default nginx is started as nobody, with the Ls-al command to view the Proxy_temp directory Nobody is the owner of the Proxy_temp directory, it is strange that why do not have permission, next I look at the proxy_temp of the parent directory is nginx installation directory. found that nobody not authority, no wonder the above problems. IT network, http://www.it.net.cn
Then set anyone can write proxy_temp directory, restart Nginx can be resolved.
For example, my proxy_temp directory is/usr/local/nginx/proxy_temp, with the command chmod-r 777/usr/local/nginx/proxy_temp/set to anyone can write, problem solving.
The above describes the Nginx--web website pictures show slow oversized attachments are not completely downloaded solution, including the content, I hope to be interested in PHP tutorial friends helpful.