Question

Why Nginx is not properly working in CentOS7, Can any one suggest me

[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.


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.

Ryan Quinn
DigitalOcean Employee
DigitalOcean Employee badge
April 10, 2018
Accepted Answer

The errors shown here indicate that ports 80 and 443 on your droplet are already in use. If you already have Apache or another web server running on your droplet you will need to stop that service in order to start nginx. Two services cannot share the same port so if you have a need to run both you’ll need to configure them to use different ports.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more