错误104:使用节点js在Nginx中通过对等方重置连接

时间:2016-08-18 19:28:55

标签: node.js amazon-web-services nginx

2016/08/18 18:15:28 [error] 19201#0: *38 upstream prematurely closed connection while reading response header from upstream, client: 116.36.170.142, server: , request: "POST /adm/contents/insert HTTP/1.1", upstream: "http://127.0.0.1:8081/adm/contents/insert", host: "cidermics.com", referrer: "http://cidermics.com/adm/contents/insert"
2016/08/18 18:15:28 [error] 19201#0: *38 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 116.36.170.142, server: , request: "POST /adm/contents/insert HTTP/1.1", upstream: "http://127.0.0.1:8081/adm/contents/insert", host: "cidermics.com", referrer: "http://cidermics.com/adm/contents/insert"

104:由对等方重置连接

当我在Nginx AWS Elastic Beanstalk中插入一些内容时,这是一个错误。

(但是当我上传相同的东西时,我可以将它插入localhost服务器。)

502 Bad Gateway nginx / 1.8.1

重要的是我可以在sql server中的短代码时插入它(但有时我甚至不能插入短代码,如果它包括粗体标记或颜色字体等),

但如果我在长码时插入它,则无法上传。

(即使它可以插入localhost。)

我认为问题是Nginx或SQL。

我曾经有一个nginx太大的实体错误所以我把“client_max_body_size size;”。

AWS错误日志代码

/var/app/current/node_modules/mysql/lib/protocol/Parser.js:77
        throw err; // Rethrow non-MySQL errors
        ^

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1
    at Query.Sequence._packetToError (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:48:14)
    at Query.ErrorPacket (/var/app/current/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)
    at Protocol._parsePacket (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:280:23)
    at Parser.write (/var/app/current/node_modules/mysql/lib/protocol/Parser.js:73:12)
    at Protocol.write (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/var/app/current/node_modules/mysql/lib/Connection.js:98:28)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:531:20)
    --------------------
    at Protocol._enqueue (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:141:48)
    at PoolConnection.query (/var/app/current/node_modules/mysql/lib/Connection.js:203:25)
    at /var/app/current/routes/model/mysql.js:28:14
    at Ping.onOperationComplete [as _callback] (/var/app/current/node_modules/mysql/lib/Pool.js:101:5)
    at Ping.Sequence.end (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
    at Ping.Sequence.OkPacket (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:105:8)
    at Protocol._parsePacket (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:280:23)
    at Parser.write (/var/app/current/node_modules/mysql/lib/protocol/Parser.js:73:12)
    at Protocol.write (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/var/app/current/node_modules/mysql/lib/Connection.js:98:28)

proxy.conf

# Elastic Beanstalk Managed

# Elastic Beanstalk managed configuration file
# Some configuration of nginx can be by placing files in /etc/nginx/conf.d
# using Configuration Files.
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html 
# 
# Modifications of nginx.conf can be performed using container_commands to modify the staged version
# located in /tmp/deployment/config/etc#nginx#nginx.conf
	
upstream nodejs {
    server 127.0.0.1:8081;
    keepalive 256;
}

server {
	
	client_max_body_size 3000M;
    listen 80;
    if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
        set $year $1;
        set $month $2;
        set $day $3;
        set $hour $4; 
    }
    access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;
    access_log  /var/log/nginx/access.log  main;
	
	

    location / {
    	client_max_body_size 3000M;
        proxy_pass  http://nodejs;
        proxy_set_header   Connection "";
        proxy_http_version 1.1;  
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        
       
    }
gzip on;
gzip_comp_level 4;
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
 
    
}

0 个答案:

没有答案