Question

Can't start nginx.

Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and "journalctl -xe

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

You have a duplication for your server_name declaration in one or more of your files. I sometimes run into this when I copy the default.conf file and there is a sever_name _; entry in both files.

Type “nginx -t” to see what the error may be.

[root@localhost bin]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@localhost bin]# nginx nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) nginx: [emerg] still could not bind() [root@localhost bin]# systemctl status nginx.service ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2018-04-09 16:35:28 IST; 6min ago Process: 22654 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE) Process: 22597 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 22595 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Apr 09 16:35:27 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) Apr 09 16:35:27 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use) Apr 09 16:35:28 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 Apr 09 16:35:28 localhost.localdomain nginx[22654]: nginx: [emerg] still could not bind() Apr 09 16:35:28 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server. Apr 09 16:35:28 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. Apr 09 16:35:28 localhost.localdomain systemd[1]: nginx.service failed.

How can i fixed.