I decided to follow the Multiple Blogs Tutorial to set up a second ghost instance on a droplet. Already had a second nginx config file set up to run a second domain and was testing that site. Shut down both ghost and nginx with ‘service ghost stop’ and ‘service nginx stop’. No error messages seen.
Modified the second nginx config file in sites-enabled and attempted to restart nginx with ‘service nginx restart’. Saw ‘Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.’
The error log shows:
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to [::]:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:443 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to [::]:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:443 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to [::]:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:443 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to [::]:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:443 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to [::]:80 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: bind() to 0.0.0.0:443 failed (98: Address already in use)
2017/09/15 04:09:48 [emerg] 24518#24518: still could not bind()
Attempted to revert back to previous config file. Still fails. Ran ‘nginx -t’ and saw no syntax errors. Ran ‘ps -aux’ and see:
root@ghost-1gb-sfo2-01:/etc/nginx/sites-enabled# ps -aux | grep nginx
root 24899 0.0 0.0 12948 940 pts/0 S+ 04:34 0:00 grep --color=auto nginx
root 31045 0.0 0.3 126944 3452 ? Ss Sep02 0:00 nginx: master process nginx -c /etc/nginx/nginx.conf
www-data 31053 0.0 0.5 127096 6072 ? S Sep02 0:11 nginx: worker process
What’s going on here? Shouldn’t the ‘service nginx stop’ have killed all the processes? Is that what is causing the restart to fail?
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!
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.
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.
@noyce
You probably have another process listening on ports
80
and443
, paste the output of these two commands to check:netstat -ltnp | grep 80
andnetstat -ltnp | grep 443
In my case I had Apache running alongside NGinx, by default - at least in Ubuntu 16.04 they run on the same ports.
Kill those processes and then try again. If it makes it any easier then use htop for this.