StackShelf
nginxエラー エラー解決

502 Bad Gateway upstream: http://127.0.0.1:3002/api の原因と解決法

502 Bad Gateway upstream: http://127.0.0.1:3002/api の原因と具体的な解決手順をまとめました。

1分で読める
nginxnginxエラー502 Bad Gateway upstream502 Bad Gateway upstream: http://127.0.0

エラーメッセージ(全文)

502 Bad Gateway upstream: http://127.0.0.1:3002/api

このエラーとは

502 Bad Gateway upstream: http://127.0.0.1:3002/api は nginx 開発でよく遭遇するエラーです。

想定環境: Windows / macOS / Linux

よく出る状況: nginx 設定・プロキシ

よくある原因

  • location ネスト
  • upstream ダウン
  • レート制限

解決方法

方法1: nginx -t

設定テスト後 reload.

それでも直らないとき

バージョン情報(nginx のバージョン、OS、実行コマンド)を添えて、エラーメッセージ全文と直前に変更した点を確認してください。ログの数行上にも原因の手がかりが残っていることが多いです。

まとめ

「502 Bad Gateway upstream: http://127.0.0.1:3002/api」は location ネスト が原因のことが多いです。上記の手順で切り分けてください。

次にやること

同じ nginx カテゴリの関連エラーもあわせて確認してください。

よくある質問

502 Bad Gateway upstream: http://127.0.0.1:3002/api とは何ですか?

502 Bad Gateway upstream: http://127.0.0.1:3002/api は nginx 実行時に表示されるエラーです。location ネスト

502 Bad Gateway upstream: http://127.0.0.1:3002/api の原因は?

location ネスト。upstream ダウン。レート制限。

502 Bad Gateway upstream: http://127.0.0.1:3002/api の直し方は?

nginx -t:設定テスト後 reload.

nginx で 502 Bad Gateway upstream が出るのはなぜ?

nginx 設定・プロキシ

502 Bad Gateway upstream: http://127.0.0.1:3002/api を防ぐには?

次に読むべき記事

同カテゴリ「nginxエラー」の記事

学習ルート

体系的に学びたい方はこちらから。

エラー・トラブル集で続きを探す →

あわせて読みたい