how to restart nginx - zhongguogu/Linux GitHub Wiki
nginx启动失败,检查日志/var/log/nging/error.log
(base) panda@sh-pip-pdfengine02:~$ sudo journalctl -xe
Feb 18 10:00:10 sh-panda.org.com sudo[33617]: pam_unix(sudo:session): session opened for user root by panda(uid=0)
Feb 18 10:00:10 sh-panda.org.com sudo[33617]: pam_unix(sudo:session): session closed for user root
Feb 18 10:00:14 sh-panda.org.com sudo[33623]: panda : TTY=pts/1 ; PWD=/home/panda ; USER=root ; COMMAND=/bin/systemctl status nginx
Feb 18 10:00:14 sh-panda.org.com sudo[33623]: pam_unix(sudo:session): session opened for user root by panda(uid=0)
Feb 18 10:00:14 sh-panda.org.com sudo[33623]: pam_unix(sudo:session): session closed for user root
Feb 18 10:00:15 sh-panda.org.com dhclient[2096]: DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 9 (xid=0xbefdbf45)
Feb 18 10:00:24 sh-panda.org.com dhclient[2096]: DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 12 (xid=0xbefdbf45)
Feb 18 10:00:36 sh-panda.org.com dhclient[2096]: DHCPDISCOVER on eno1 to 255.255.255.255 port 67 interval 18 (xid=0xbefdbf45)
Feb 18 10:00:43 sh-panda.org.com sudo[33633]: panda : TTY=pts/1 ; PWD=/home/panda ; USER=root ; COMMAND=/bin/systemctl start nginx
Feb 18 10:00:43 sh-panda.org.com sudo[33633]: pam_unix(sudo:session): session opened for user root by panda(uid=0)
Feb 18 10:00:43 sh-panda.org.com systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Feb 18 10:00:43 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9006 failed (98: Address already in use)
Feb 18 10:00:43 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9100 failed (98: Address already in use)
Feb 18 10:00:43 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Feb 18 10:00:43 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9006 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9100 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9006 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9100 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Feb 18 10:00:44 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9006 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9100 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9006 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:9100 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Feb 18 10:00:45 sh-panda.org.com nginx[33640]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 18 10:00:46 sh-panda.org.com nginx[33640]: nginx: [emerg] still could not bind()
Feb 18 10:00:46 sh-panda.org.com systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 18 10:00:46 sh-panda.org.com systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
使用如下命令都不能正常重启
sudo systemctl restart/start/stop/reload nginx
sudo service nginx restart/start/stop/reload
使用如下命令正常
sudo pkill -f nginx & wait $!
sudo systemctl start nginx