gpt4 book ai didi

linux - 亚马逊 Linux AMI : NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

转载 作者:太空宇宙 更新时间:2023-11-04 12:40:22 26 4
gpt4 key购买 nike

我在错误日志中收到如下 nginx 错误:

[error] 4257#0: *3470 upstream timed out (110: Connection timed out) while reading response header from upstream, client 120.X.X.X

这是一个运行 AWS 并使用 nginx 作为反向代理的 Wordpress 网络服务器。这是我的配置文件:

user                 nginx nginx;
worker_processes 2;
worker_rlimit_nofile 10240;

include /etc/nginx/modules.d/*.conf;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

events {
worker_connections 8192;
use epoll;
accept_mutex_delay 100ms;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr $server_name $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time';
log_format backend '$remote_addr $server_name $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time';
log_format proxylog '$remote_addr $server_name $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time '
'"$http_proxy"';

access_log /var/log/nginx/access.log main;
access_log /var/log/nginx/badactor.log proxylog if=$http_proxy;

server_name_in_redirect off;
server_tokens off;

sendfile on;
open_file_cache max=100 inactive=20s;
tcp_nopush on;

keepalive_timeout 5;

client_max_body_size 4M;
client_body_buffer_size 256k;


if_modified_since before;

gzip on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 6;
gzip_types text/plain
text/xml
text/css
text/javascript
application/xhtml+xml
application/xml
application/rss+xml
application/atom_xml
application/javascript
application/x-javascript
application/x-httpd-php;
gzip_disable "MSIE [1-6]\.";

# proxy cache
proxy_cache_path /var/cache/nginx/proxy_cache levels=1:2
keys_zone=czone:32m max_size=256m inactive=1440m;
proxy_temp_path /var/cache/nginx/proxy_temp;
proxy_cache_key "$scheme://$host$request_uri";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Remote-Addr $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-UA-Detect $mobile;
proxy_set_header Accept-Encoding "";
proxy_set_header Proxy "";
proxy_hide_header X-Pingback;
proxy_hide_header Link;
proxy_hide_header ETag;
proxy_connect_timeout 5;
proxy_send_timeout 10;
proxy_read_timeout 90;
proxy_cache_use_stale timeout invalid_header http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_lock_timeout 5s;
proxy_buffers 8 32k;
proxy_buffer_size 64k;

# fastcgi cache
#fastcgi_cache_path /var/cache/nginx/fastcgi_cache levels=1:2
# keys_zone=fastcgizone:32m inactive=60m;
#fastcgi_cache_key "$scheme$request_method$host$request_uri";
#fastcgi_cache_use_stale error timeout invalid_header http_500;

#limit_req_zone $request_method zone=method:1m rate=250r/s;

upstream backend {
server unix:/var/run/nginx-backend.sock;
}

upstream phpfpm {
server unix:/var/run/php-fpm.sock;
}


include /etc/nginx/conf.d/*.conf;
}

在客户端,收到一个 http 502(错误的网关)。有什么问题吗?

最佳答案

在 nginx.conf 文件中,我将 proxy_read_timeout 值增加到 300,之前设置为 90。重启 nginx 和 php-fpm 后,问题已解决。

关于linux - 亚马逊 Linux AMI : NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40440875/

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