Created
June 27, 2018 05:25
-
-
Save shau-lok/b896d1965ed376c38b9a6a6af88c524c to your computer and use it in GitHub Desktop.
【nginx 错误】Upstream prematurely closed connection while reading upstream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Had a similar problem with my reverse proxy. | |
This is the configuration that finally did it for me: | |
location / { | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forward-Proto http; | |
proxy_set_header X-Nginx-Proxy true; | |
proxy_temp_file_write_size 64k; | |
proxy_connect_timeout 10080s; | |
proxy_send_timeout 10080; | |
proxy_read_timeout 10080; | |
proxy_buffer_size 64k; | |
proxy_buffers 16 32k; | |
proxy_busy_buffers_size 64k; | |
proxy_redirect off; | |
proxy_request_buffering off; | |
proxy_buffering off; | |
proxy_pass http://192.168.1.201:9100/; | |
} | |
# my nginx.conf | |
worker_processes auto; | |
events { | |
worker_connections 1024; | |
use epoll; | |
multi_accept on; | |
} | |
http { | |
tcp_nodelay on; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
proxy_http_version 1.1; | |
#server { | |
# listen 80; | |
# server_name _; | |
# return 403; | |
#} | |
server { | |
listen 80; | |
server_name 120.78.165.24; | |
charset utf-8; | |
client_max_body_size 75M; | |
#location /static { | |
# alias /opt/www/static; | |
#} | |
location / { | |
proxy_pass http://web:5000; | |
proxy_read_timeout 10080; | |
proxy_send_timeout 10080; | |
proxy_connect_timeout 10080s; | |
proxy_request_buffering off; | |
proxy_buffering off; | |
proxy_buffer_size 64k; | |
proxy_buffers 16 32k; | |
proxy_busy_buffers_size 64k; | |
proxy_temp_file_write_size 64k; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment