这个可以正常访问

发布 Nginx 23


详细信息为:
    2019/09/07 16:08:23 [error] 4860#7928: *1 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream, client: 192.168.2.215, server: 192.168.2.200, request: "GET /index.html HTTP/1.1", upstream: "http://192.168.2.200:61003/index.html", host: "192.168.2.200"。
http://192.168.2.200:61003/index.html,这个可以正常访问。
配置为:
    http {
    include mime.types;
    default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log logs/access.log main;
    sendfile on;
    #tcp_nopush on;
    #keepalive_timeout 0;
    upstream server1 {
     #ip_hash;
     server 192.168.2.200:61003;
     server 192.168.2.200:61001;
    }
    #gzip on;
    server {
     listen 80;
     server_name 192.168.2.200;
     #charset koi8-r;
     #access_log logs/host.access.log main;
     location / {
    #root html;
    #index index.html index.htm;
     proxy_pass http://server1;
     #proxy_set_header Connection keep-alive;
    #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 Connection keep-alive;,这个加上就好了