Nginx起動時に Job for nginx.service failed because the control process exited with error codeが出る場合の対処法

こんにちは!kossyです!




今回はNginxの起動時に Job for nginx.service failed because the control process exited with error codeが出る場合の対処法についてブログに残してみたいと思います。





sudo nginx -t の実行

sudo nginx -tを実行すると、不具合の原因を表示することができます。

以下は特に問題がなかった場合です。

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

問題がある場合は、問題のある箇所を教えてくれます。

nginx: [emerg] host not found in upstream "puma_sample_rails.conf" in /etc/nginx/conf.d/sample_rails.conf:25
nginx: configuration file /etc/nginx/nginx.conf test failed

hostが見つからないとのことなので、正しくhostを指定すればOKです。



大いに参考にさせていただいたサイト

この場を借りて御礼を申し上げます。

Nginxでよく使われるコマンド10選 | TECH+