django - nginx 错误 502 上游过早关闭连接,同时从上游读取响应标头
问题描述
几天来,我一直在努力解决这个问题,终于走到了一堵砖墙。当我在浏览器中导航到该页面时,该页面会挂起几秒钟,然后才会出现 502 Bad Gateway Screen。
任何想法任何人???
网址https://sv1.stream05.xyz/link/?driveId=0BwHxX3yoJoeuYzZlNm1jYVhwWWs
根据 NGINX 日志,NGINX 说:
2020/11/04 18:56:31 [error] 14920#14920: *15 upstream prematurely closed connection while reading response header from upstream, client: 141.101.84.6, server: sv1.stream05.xyz, request: "GET /link/?driveId=0BwHxX3yoJoeuYzZlNm1jYVhwWWs HTTP/1.1", upstream: "http://127.0.0.1:6868/link/?driveId=0BwHxX3yoJoeuYzZlNm1jYVhwWWs", host: "sv1.stream05.xyz"
nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
upstream LoadBalancer {
server 127.0.0.1:6666;
}
upstream ProxyStream {
server 127.0.0.1:6868;
}
server {
listen 80;
server_name proxy.stream05.xyz;
location / {
proxy_pass http://LoadBalancer;
proxy_http_version 1.1;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name sv1.stream05.xyz;
location / {
proxy_pass http://ProxyStream;
proxy_http_version 1.1;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
解决方案
推荐阅读
- asp.net - 在 asp.net core web application 2.1 中搭建一个管理员 CRUD
- r - 从 R 驱动声卡
- datatable - 如果表为空,则 JQuery 响应式数据表不起作用
- tabulator - 我错过了如何正确添加按钮吗?
- mysql - SQL 为每个不同的设备 ID 选择 200 个最近的时间戳
- php - 如何通过过滤MySql上的多个列来限制多个数字?
- c# - .net 核心控制台应用程序使用基本身份验证调用 PHP REST API
- python - 在 if 语句中添加地址
- r - R Shiny 在侧边栏中布置 2x2 表格,以便数字输入可见
- javascript - 我需要我的 ReactJS 应用程序在没有服务器的情况下离线工作