版权声明:转载请注明出处,否则自行负责所有后果 https://blog.csdn.net/ljx1528/article/details/87358761
1、nginx后台error日志报错信息如下:
2019/02/01 13:06:35 [error] 14324#0: *448906971 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.1.14, server: localhost, request: "GET /h5teb/ugcH5/index.htm?source=android&mall=8&TGC=911FDD2F99B84D528F0A7EE71780A943 HTTP/1.1", upstream: "http://192.168.1.14:8080/h5teb/ugcH5/index.htm?source=android&mall=8&TGC=911FDD2F99B84D528F0A7EE71780A943", host: "192.168.1.14"
2019/02/01 13:06:45 [error] 12013#0: *441119082 client intended to send too large body: 13346 bytes, client: 192.168.1.14, server: localhost, request: "POST /h5teb/complaints/save.htm HTTP/1.1", host: "192.168.1.14", referrer: "http://192.168.1.14/h5teb/complaints/index.htm"
2、添加对文件上传的限制
在转发http中进行配置10\m的上限,client_max_body_size 10m
host-192-168-1-15:/usr/local/nginx/logs # vim /usr/local/nginx/conf/nginx.conf
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_header_buffer_size 64k;
large_client_header_buffers 4 64k;
client_body_buffer_size 20m;
client_max_body_size 10m;
proxy_buffer_size 64k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 256k;
underscores_in_headers on;
}
3、重新加载nginx服务即可
host-192-168-1-15:/usr/local/nginx # ./sbin/nginx -s reload