问题描述:
http://www.xxx.net ota、apk包上传正常
http://www.xxx.net:8080 ota、apk包上传不正常
查看nginx error日志
[root@VM_58_118_centos xxx.net]# cat /data/nginx/vhosts/xxx.net.conf |grep error_log #error_log error_log /data/nginx/logs/xxx.net.error.access.log error; [root@VM_58_118_centos xxx.net]# tail -f /data/nginx/logs/xxx.net.error.access.log [crit] 20462#0: *3436 pwritev() "/var/lib/nginx/tmp/client_body/0000000002
修改nginx.conf
[root@VM_58_118_centos xxx.net]# vim /etc/nginx/nginx.conf http { client_max_body_size 2048m; client_body_buffer_size 2m; client_body_temp_path /data/www/upload_temp; #默认/var/lib/nginx/tmp/client_body client_header_buffer_size 10m; large_client_header_buffers 4 10m; ...... }
优化nginx proxy参数
[root@VM_58_118_centos xxx.net]# vim /etc/nginx/proxy.conf proxy_redirect off; proxy_set_header X-Forwarded-proto $scheme; 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_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_max_temp_file_size 0; proxy_connect_timeout 600; proxy_send_timeout 1800; proxy_read_timeout 1800; proxy_buffer_size 512k; proxy_buffers 4 512k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 512k;
fastcgi相关参数
[root@VM_58_118_centos xxx.net]# vim /etc/nginx/nginx.conf http { #fastcgi_connect_timeout 300; #fastcgi_send_timeout 300; #fastcgi_read_timeout 300; #fastcgi_buffer_size 64k; #fastcgi_buffers 4 64k; }
重启nginx服务
[root@VM_58_118_centos vhosts]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@VM_58_118_centos xxx.net]# systemctl restart nginx