I'm trying to restart nginx, and systemd doesn't want to.
As far as I can tell, nginx is humming along just fine, and it's answering requests as expected, but systemd doesn't appear to think it's in control of the service, so I guess it tries to start a new copy, which fails because now it tries to bind to :80 which is already taken.
After some troubleshooting, I just gave up and rebooted the machine, figuring that would resolve the issue, but to my surprise that lands me back in the same state again.
The only way I can find to make systemd happy is
# killall nginx
# systemctl restart nginx.service
But I obviously don't want to rely on that. Info about my current state:
# systemctl restart nginx.service
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
# journalctl -xe
-- Unit nginx.service has begun starting up.
Oct 22 12:12:43 shared1 nginx[4772]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx[4772]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx[4772]: nginx: [emerg] still could not bind()
systemd[1]: nginx.service: Control process exited, code=exited status=1
systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
# netstat -lpn | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3607/nginx
# ps fax | grep nginx
4827 pts/0 S+ 0:00 \_ grep --color=auto nginx
3607 ? Ss 0:00 nginx: master process /usr/sbin/nginx
3608 ? S 0:00 \_ nginx: worker process
3609 ? S 0:00 \_ nginx: cache manager process
# cat /etc/issue
Ubuntu 16.04.3 LTS \n \l
$ nginx -v
nginx version: nginx/1.10.3 (Ubuntu)
$ find /etc/systemd/ /lib/systemd/system -name nginx.service
/etc/systemd/system/multi-user.target.wants/nginx.service
/lib/systemd/system/nginx.service
$ stat /etc/systemd/system/multi-user.target.wants/nginx.service 2>&1 | head -n1
File: '/etc/systemd/system/multi-user.target.wants/nginx.service' -> '/lib/systemd/system/nginx.service'
$ stat /lib/systemd/system/nginx.service 2>&1 | head -n2
File: '/lib/systemd/system/nginx.service'
Size: 986 Blocks: 8 IO Block: 4096 regular file