Job for nginx.service failed because the control process exited with error code.

By | January 5, 2021

When you try to restart the nginx service, you encounter error message similar to this. The outcome can be not only frustrating but can also prevent you from doing other work.

I encountered this error message:

sibgen@en-pta-web-109:~# service nginx start
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xe” for details.

sibgen@en-pta-web-109:~# service nginx status
● 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 Tue 2021-01-05 16:52:36 UTC; 2min 11s ago
Docs: man:nginx(8)

Jan 05 16:52:34 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Jan 05 16:52:34 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 05 16:52:35 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Jan 05 16:52:35 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 05 16:52:35 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Jan 05 16:52:35 en-pta-web-109 nginx[467554]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jan 05 16:52:36 en-pta-web-109 nginx[467554]: nginx: [emerg] still could not bind()
Jan 05 16:52:36 en-pta-web-109 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jan 05 16:52:36 en-pta-web-109 systemd[1]: nginx.service: Failed with result ‘exit-code’.
Jan 05 16:52:36 en-pta-web-109 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
sibgen@en-pta-web-109:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

The workaround that can help you resolve this issue if you encounter it:

sibgen@en-pta-web-109:~# sudo fuser -k 80/tcp
80/tcp: 467460 467461
sibgen@en-pta-web-109:~# sudo fuser -k 443/tcp
sibgen@en-pta-web-109:~# sudo service nginx restart
sibgen@en-pta-web-109:~# service nginx status
● nginx.service – A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-01-05 16:58:06 UTC; 11s ago
Docs: man:nginx(8)
Process: 474663 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 474664 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 474665 (nginx)
Tasks: 2 (limit: 1132)
Memory: 9.7M
CGroup: /system.slice/nginx.service
├─474665 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─474666 nginx: worker process

Jan 05 16:58:06 en-pta-web-109 systemd[1]: Starting A high performance web server and a reverse proxy server…
Jan 05 16:58:06 en-pta-web-109 systemd[1]: Started A high performance web server and a reverse proxy server.

If this solution worked for you, then we’ll love your support. You can reach out and request Server installation service from us.