Nginx 增加504超时错误

Nginx 增加504超时错误,nginx,timeout,fastcgi,gateway,Nginx,Timeout,Fastcgi,Gateway,是否有任何方法可以使错误504网关超时更长?如果有,更改文件的方式和位置。我在centos 6上使用nginx取决于您拥有的网关类型,您应该使用如下内容: proxy_read_timeout 600s; 检查文档:如果是fastcgi超时错误,则需要增加fastcgi\u read\u超时 # /etc/nginx/conf.d/example.com.conf server { location ~ \.(php)$ { fastcgi_pass unix:/va

是否有任何方法可以使错误504网关超时更长?如果有,更改文件的方式和位置。我在centos 6上使用nginx

取决于您拥有的网关类型,您应该使用如下内容:

proxy_read_timeout 600s;

检查文档:

如果是
fastcgi
超时错误,则需要增加
fastcgi\u read\u超时

# /etc/nginx/conf.d/example.com.conf
server {

    location ~ \.(php)$ {
        fastcgi_pass unix:/var/run/php74-example.com.sock;
        fastcgi_read_timeout 300s;
错误日志)上游超时

# tail -f example.com.error.log
2020/12/29 14:51:42 [error] 30922#30922: 
*9494 upstream timed out (110: Connection timed out) while reading response header from upstream,
...
upstream: "fastcgi://unix:/var/run/php74-example.com.sock",
...
nginx手册)


调用在Chrome DevTools中运行超过60秒的脚本的结果

默认60秒

fastcgi\u读取\u超时300s


我发现其中提到了一些额外的超时设置。这在这方面也会有帮助。我试着先回答这个问题。提到的其他选项与nginx无关,也与修复错误504无关(除了*\u connect\u timeout porbly…但这与网络连接问题有关)。是的,我知道这一点,我也发现你的答案对我很有帮助。我只是觉得这些额外的信息可能也会对其他人有所帮助。)你需要在时间上写“s”吗<代码>代理读取超时60秒@DavidLin,你说得对,虽然秒是默认值,但测量单位应按秒添加
Default: fastcgi_read_timeout 60s;
Context: http, server, location