Nginx would not resume after VPN was down - Torniojaws/vortech-backend GitHub Wiki

The VPS was down unexpectedly, and after it was fixed, Nginx would not restart.

In /var/log/nginx/error.log there was this:

2018/01/19 03:47:30 [warn] 359#359: conflicting server name "vortechmusic.com" on 0.0.0.0:443, ignored
2018/01/19 03:47:32 [warn] 641#641: conflicting server name "vortechmusic.com" on 0.0.0.0:443, ignored
2018/01/19 03:47:32 [emerg] 641#641: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/01/19 03:47:32 [emerg] 641#641: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/01/19 03:47:32 [emerg] 641#641: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/01/19 03:47:32 [emerg] 641#641: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/01/19 03:47:32 [emerg] 641#641: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/01/19 03:47:32 [emerg] 641#641: still could not bind()

From instructions on this site: https://easyengine.io/tutorials/nginx/troubleshooting/emerg-bind-failed-98-address-already-in-use/

The fix was to run:

sudo fuser -k 80/tcp to kill the stuck listener in port 80 sudo service nginx start to start nginx again.

Then everything worked again.

Some SO question seems to suggest this is a bug in Nginx and the above is the way to "fix" it. https://serverfault.com/questions/675526/cant-restart-nginx-bind-failed-98-address-already-in-use

Might also fix the warning: sudo nginx -t

Which gives:

nginx: [warn] conflicting server name "vortechmusic.com" on 0.0.0.0:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

It's not a critical bug though.