nginx 启动报错:Job for nginx.service failed because the control process exited with error code
时间:2019-02-02 16:57 来源:linux.it.net.cn 作者:IT
nginx 启动报错:Job for nginx.service failed because the control process exited with error code
nginx 启动报错:Job for nginx.service failed because the control process exited with error code
>>> service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
根据提示输入命令:
systemctl status nginx.service
>>> systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since 五 2018-08-31 11:08:14 CST; 5min ago
Process: 4668 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)
Process: 28149 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 28146 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 4455 (code=killed, signal=KILL)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:14 user-70DGA014CN nginx[28149]: nginx: [emerg] still could not bind()
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Control process exited, code=exited status=1
8月 31 11:08:14 user-70DGA014CN systemd[1]: Failed to start A high performance web server and a reverse proxy server.
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Unit entered failed state.
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Failed with result 'exit-code'.
8月 31 11:08:49 user-70DGA014CN systemd[1]: Stopped A high performance web server and a reverse proxy server.
journalctl -xe
>>> journalctl -xe
8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
8月 31 11:08:14 user-70DGA014CN nginx[28149]: nginx: [emerg] still could not bind()
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Control process exited, code=exited status=1
8月 31 11:08:14 user-70DGA014CN systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: nginx.service 单元已失败
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- nginx.service 单元已失败。
--
-- 结果为“failed”。
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Unit entered failed state.
8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Failed with result 'exit-code'.
8月 31 11:08:49 user-70DGA014CN systemd[1]: Stopped A high performance web server and a reverse proxy server.
-- Subject: nginx.service 单元已结束停止操作
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- nginx.service 单元已结束停止操作。
从上述信息中可以看出nginx的80端口被使用(但这不是最主要的问题)
第一个解决方法:
注意:
如果曾经修改/etc/nginx/conf.d/default.conf或者是/etc/nginx/nginx.conf文件,并且使用命令:systemctl restart nginx.service,那么就会出现错误信息如下:
>>> service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
这时你需要打开default.conf或nginx.conf文件,查看是否少写了一个分号。
第二个解决方法:
卸载nginx,并且删除nginx相关文件。
重装nginx
(责任编辑:IT)
nginx 启动报错:Job for nginx.service failed because the control process exited with error code nginx 启动报错:Job for nginx.service failed because the control process exited with error code >>> service nginx restart Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. 根据提示输入命令: systemctl status nginx.service >>> systemctl status nginx.service ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since 五 2018-08-31 11:08:14 CST; 5min ago Process: 4668 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE) Process: 28149 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE) Process: 28146 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 4455 (code=killed, signal=KILL) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:14 user-70DGA014CN nginx[28149]: nginx: [emerg] still could not bind() 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Control process exited, code=exited status=1 8月 31 11:08:14 user-70DGA014CN systemd[1]: Failed to start A high performance web server and a reverse proxy server. 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Unit entered failed state. 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Failed with result 'exit-code'. 8月 31 11:08:49 user-70DGA014CN systemd[1]: Stopped A high performance web server and a reverse proxy server. journalctl -xe >>> journalctl -xe 8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:12 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) 8月 31 11:08:13 user-70DGA014CN nginx[28149]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) 8月 31 11:08:14 user-70DGA014CN nginx[28149]: nginx: [emerg] still could not bind() 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Control process exited, code=exited status=1 8月 31 11:08:14 user-70DGA014CN systemd[1]: Failed to start A high performance web server and a reverse proxy server. -- Subject: nginx.service 单元已失败 -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- nginx.service 单元已失败。 -- -- 结果为“failed”。 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Unit entered failed state. 8月 31 11:08:14 user-70DGA014CN systemd[1]: nginx.service: Failed with result 'exit-code'. 8月 31 11:08:49 user-70DGA014CN systemd[1]: Stopped A high performance web server and a reverse proxy server. -- Subject: nginx.service 单元已结束停止操作 -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- nginx.service 单元已结束停止操作。 从上述信息中可以看出nginx的80端口被使用(但这不是最主要的问题) 第一个解决方法: 注意: 如果曾经修改/etc/nginx/conf.d/default.conf或者是/etc/nginx/nginx.conf文件,并且使用命令:systemctl restart nginx.service,那么就会出现错误信息如下: >>> service nginx restart Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. 这时你需要打开default.conf或nginx.conf文件,查看是否少写了一个分号。 第二个解决方法: 卸载nginx,并且删除nginx相关文件。 重装nginx (责任编辑:IT) |