gpt4 book ai didi

python - Nginx 网关超时,服务器负载不大

转载 作者:行者123 更新时间:2023-11-28 19:06:20 25 4
gpt4 key购买 nike

我正在使用 NGINX 和 UWSGI 为基于 python/Django 的 API 后端提供支持,负载均衡器连接到 AWS 自动缩放组,我的服务器在日常工作中运行良好,但有时一两个月开始从服务器获取 504 或 502 一次持续一天或更长时间。我的服务器上的负载低于常规,内存使用情况良好,但仍然得到 502 或 504

使用 ubuntu 14.0.4

这是我的 nginx 配置的样子

user www-data;
worker_processes 2;
pid /run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
worker_rlimit_nofile 40000;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 50s;
keepalive_requests 1024;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
limit_conn_zone $binary_remote_addr zone=addr:10m;
limit_conn addr 20;
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
log_format json '{"method": "$request_method", "uri":
"$request_uri", "status": $status, "request_time": $request_time,
"upstream_response_time": $upstream_response_time, "body_bytes_sent":
$body_bytes_sent, "http_user_agent": "$http_user_agent", "remote":
"$remote_addr", "upstream": "$upstream_addr", "proxy": "$proxy_host"}';
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
#gzip_buffers 16 8k;
#gzip_http_version 1.1;
#gzip_types text/plain text/css application/json;
gzip_types text/plain text/css application/json application/x-
javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

最佳答案

首先,确定哪个服务器返回超时错误。负载均衡器或 Nginx Worker

关于python - Nginx 网关超时,服务器负载不大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46338138/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com