0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【nginx】504 Gateway Time-out

Posted at

サーバーにアップロードしたwebアプリが504を返すようになっちゃったときのメモ

環境

  • nginx(1.26.0)

エラーログ

/var/log/nginx/error.log
upstream timed out (110: Connection timed out) while reading response header from upstream, "fastcgi://unix:/run/***",

cgiがタイムアウトしてる

タイムアウトまでの時間を延ばしてみる

/etc/nginx/nginx.conf
send_timeout 300;
keepalive_timeout 300;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;

各パラメータの説明

send_timeout

  • クライアントへのレスポンス送信にかかる最大時間
  • デフォルト60秒

keepalive_timeout

  • Keep-Alive接続のタイムアウトするまでの時間
  • デフォルト75秒
  • Keep-Aliveは、1回のTCP接続で複数のHTTPリクエストを処理する機能で、接続を再利用することでCPU負荷や時間を節約できる

fastcgi_connect_timeout

  • FastCGIサーバーとの接続を確立するための最大時間
  • デフォルト60秒

fastcgi_send_timeout

  • FastCGIサーバーへのリクエストを送信する際の最大時間
  • デフォルト60秒

fastcgi_read_timeout

  • FastCGIサーバーからの応答を待つ最大時間
  • デフォルト60秒

再起動

sudo systemctl restart nginx

表示できた

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?