yxw886 大佬有话说 :
军哥lnmp1.7重启后nginx无法自启
本帖最后由 yxw886 于 2020-9-23 01:09 编辑
一开始都是正常的,服务器重启nginx还会自动启动,突然今天重启服务器,发现网站打不开了,systemctl status nginx,提示
● nginx.service – The NGINX HTTP and reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-09-23 00:27:22 CST; 1min 17s ago
Process: 1632 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
Main PID: 1095 (code=killed, signal=KILL)
Sep 23 00:27:22 web.novalocal kill: -q, –queue <sig> use sigqueue(2) rather than kill(2)
Sep 23 00:27:22 web.novalocal kill: -p, –pid print pids without signaling them
Sep 23 00:27:22 web.novalocal kill: -l, –list [=<signal>] list signal names, or convert one to a name
Sep 23 00:27:22 web.novalocal kill: -L, –table list signal names and numbers
Sep 23 00:27:22 web.novalocal kill: -h, –help display this help and exit
Sep 23 00:27:22 web.novalocal kill: -V, –versionoutput version information and exit
Sep 23 00:27:22 web.novalocal kill: For more details see kill(1).
Sep 23 00:27:22 web.novalocal systemd: nginx.service: control process exited, code=exited status=1
Sep 23 00:27:22 web.novalocal systemd: Unit nginx.service entered failed state.
Sep 23 00:27:22 web.novalocal systemd: nginx.service failed.
使用nginx -t,检查没问题
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
输入journalctl -xe,向上翻几页,看到:
Sep 23 00:27:22 web.novalocal systemd: Starting (null)…
— Subject: Unit selinux.service has begun start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit selinux.service has begun starting up.
Sep 23 00:27:22 web.novalocal systemd: nginx.service: main process exited, code=killed, status=9/KILL
Sep 23 00:27:22 web.novalocal kill: Usage:
Sep 23 00:27:22 web.novalocal kill: kill <pid|name> […]
Sep 23 00:27:22 web.novalocal kill: Options:
Sep 23 00:27:22 web.novalocal kill: -a, –all do not restrict the name-to-pid conversion to processes
Sep 23 00:27:22 web.novalocal kill: with the same uid as the present process
Sep 23 00:27:22 web.novalocal kill: -s, –signal <sig> send specified signal
Sep 23 00:27:22 web.novalocal kill: -q, –queue <sig> use sigqueue(2) rather than kill(2)
Sep 23 00:27:22 web.novalocal kill: -p, –pid print pids without signaling them
Sep 23 00:27:22 web.novalocal kill: -l, –list [=<signal>] list signal names, or convert one to a name
Sep 23 00:27:22 web.novalocal kill: -L, –table list signal names and numbers
Sep 23 00:27:22 web.novalocal kill: -h, –help display this help and exit
Sep 23 00:27:22 web.novalocal kill: -V, –versionoutput version information and exit
Sep 23 00:27:22 web.novalocal kill: For more details see kill(1).
Sep 23 00:27:22 web.novalocal systemd: nginx.service: control process exited, code=exited status=1
Sep 23 00:27:22 web.novalocal systemd: Unit nginx.service entered failed state.
Sep 23 00:27:22 web.novalocal systemd: nginx.service failed.
Sep 23 00:27:22 web.novalocal cloud-init: Cloud-init v. 0.7.9 running ‘modules:final’ at Tue, 22 Sep 2020 16:27:22 +0000. Up 12.09 seconds.
Sep 23 00:27:22 web.novalocal systemd: Started Dynamic System Tuning Daemon.
— Subject: Unit tuned.service has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit tuned.service has finished starting up.
—
— The start-up result is done.
手动输入 systemctl start nginx,可以启动,网站可以正常打开,输入systemctl status nginx,提示:
● nginx.service – The NGINX HTTP and reverse proxy server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-09-23 00:41:20 CST; 4s ago
Process: 1632 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)
Process: 2738 ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 2739 (nginx)
Tasks: 5
Memory: 82.5M
CGroup: /system.slice/nginx.service
├─2739 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
├─2740 nginx: worker process
├─2741 nginx: worker process
├─2742 nginx: worker process
└─2743 nginx: worker process
Sep 23 00:41:20 web.novalocal systemd: Starting The NGINX HTTP and reverse proxy server…
Sep 23 00:41:20 web.novalocal systemd: Started The NGINX HTTP and reverse proxy server.
有大神知道什么原因吗?
16qf 大佬有话说 :
不知道,紫薯布丁,楼下解答
caddy 大佬有话说 :
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红
试下重激活看看
systemctl enable nginx.service
llyang 大佬有话说 :
systemctl enable nginx
reboot
systemctl status nginx
看看啥情况,理论上应该没问题
如果不行,查看log报告:lol
yxw886 大佬有话说 :
caddy 大佬有话说 : 2020-9-23 01:20
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红
试下重激活看看
输入systemctl enable nginx.service后,重启,还是不会自启
https://img.ams1.imgbed.xyz/2020/09/23/OqTl.jpg
https://img.ams1.imgbed.xyz/2020/09/23/OaJr.jpg
yxw886 大佬有话说 :
llyang 大佬有话说 : 2020-9-23 01:35
systemctl enable nginx
reboot
systemctl status nginx
试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?
benetton 大佬有话说 :
检查一下LOG档是否太大 空间满了 也会这样