• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

nginx 出现504 Gateway Time-out 相关设置

武飞扬头像
larance
帮助1

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.
定义从被代理服务器读取响应的超时。超时设置仅在两个连续的读取操作之间,而不是整个响应的传输。如果代理服务器在这段时间内没有传输数据,连接将被关闭。
 

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhfjbeac
系列文章
更多 icon
同类精品
更多 icon
继续加载