nginx 出现504 Gateway Time-out 相关设置
nginx配置nginx.conf中,设置以下几个参数,增加超时时间fastcgi_connect_timeoutfastcgi连接超时时间,默认60秒fastcgi_send_timeoutnginx 进程向 fastcgi 进程发送请求过程的超时时间,默认值60秒fastcgi_read_timeoutfastcgi 进程向 nginx 进程发送输出过程的超时时间,默认值60秒php配置php
nginx配置
nginx.conf中,设置以下几个参数,增加超时时间
fastcgi_connect_timeout
fastcgi连接超时时间,默认60秒
fastcgi_send_timeout
nginx 进程向 fastcgi 进程发送请求过程的超时时间,默认值60秒
fastcgi_read_timeout
fastcgi 进程向 nginx 进程发送输出过程的超时时间,默认值60秒
php配置
php.ini
max_execution_time
php脚本最大执行时间
php-fpm
request_terminate_timeout
设置单个请求的超时时间
php程序中可加入set_time_limit(seconds)设置最长执行时间
nginx 三个代理超时时间配置
proxy_connect_timeout
proxy_send_timeout
proxy_read_timeout
我们先看下nginx官网对他们的解释:
proxy_connect_timeout 60s;
Defines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75
seconds. 定义与被代理服务器建立连接的超时时间。请注意,此超时通常不能超过75秒。
proxy_send_timeout dedault 60s
Sets a timeout for transmitting a request to the proxied server. The timeout is set only between two successive write operations, not for
the transmission of the whole request. If the proxied server does not
receive anything within this time, the connection is closed.
设置将请求传输到被代理服务器的超时时间。只在两个连续的写操作之间设置超时,而不是整个请求的传输。如果代理服务器在这段时间内没有收到数据,连接将被关闭。
proxy_read_timeout default 60s
Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for
the transmission of the whole response. If the proxied server does not
transmit anything within this time, the connection is closed.
定义从被代理服务器读取响应的超时。超时设置仅在两个连续的读取操作之间,而不是整个响应的传输。如果代理服务器在这段时间内没有传输数据,连接将被关闭。
更多推荐
所有评论(0)