全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1625|回复: 24
打印 上一主题 下一主题

军哥lnmp1.7重启后nginx无法自启

[复制链接]
跳转到指定楼层
1#
发表于 2020-9-23 01:02:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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[1632]: -q, --queue <sig>      use sigqueue(2) rather than kill(2)
Sep 23 00:27:22 web.novalocal kill[1632]: -p, --pid              print pids without signaling them
Sep 23 00:27:22 web.novalocal kill[1632]: -l, --list [=<signal>] list signal names, or convert one to a name
Sep 23 00:27:22 web.novalocal kill[1632]: -L, --table            list signal names and numbers
Sep 23 00:27:22 web.novalocal kill[1632]: -h, --help     display this help and exit
Sep 23 00:27:22 web.novalocal kill[1632]: -V, --version  output version information and exit
Sep 23 00:27:22 web.novalocal kill[1632]: For more details see kill(1).
Sep 23 00:27:22 web.novalocal systemd[1]: nginx.service: control process exited, code=exited status=1
Sep 23 00:27:22 web.novalocal systemd[1]: Unit nginx.service entered failed state.
Sep 23 00:27:22 web.novalocal systemd[1]: 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[1]: 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[1]: nginx.service: main process exited, code=killed, status=9/KILL
Sep 23 00:27:22 web.novalocal kill[1632]: Usage:
Sep 23 00:27:22 web.novalocal kill[1632]: kill [options] <pid|name> [...]
Sep 23 00:27:22 web.novalocal kill[1632]: Options:
Sep 23 00:27:22 web.novalocal kill[1632]: -a, --all              do not restrict the name-to-pid conversion to processes
Sep 23 00:27:22 web.novalocal kill[1632]: with the same uid as the present process
Sep 23 00:27:22 web.novalocal kill[1632]: -s, --signal <sig>     send specified signal
Sep 23 00:27:22 web.novalocal kill[1632]: -q, --queue <sig>      use sigqueue(2) rather than kill(2)
Sep 23 00:27:22 web.novalocal kill[1632]: -p, --pid              print pids without signaling them
Sep 23 00:27:22 web.novalocal kill[1632]: -l, --list [=<signal>] list signal names, or convert one to a name
Sep 23 00:27:22 web.novalocal kill[1632]: -L, --table            list signal names and numbers
Sep 23 00:27:22 web.novalocal kill[1632]: -h, --help     display this help and exit
Sep 23 00:27:22 web.novalocal kill[1632]: -V, --version  output version information and exit
Sep 23 00:27:22 web.novalocal kill[1632]: For more details see kill(1).
Sep 23 00:27:22 web.novalocal systemd[1]: nginx.service: control process exited, code=exited status=1
Sep 23 00:27:22 web.novalocal systemd[1]: Unit nginx.service entered failed state.
Sep 23 00:27:22 web.novalocal systemd[1]: nginx.service failed.
Sep 23 00:27:22 web.novalocal cloud-init[1605]: 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[1]: 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[1]: Starting The NGINX HTTP and reverse proxy server...
Sep 23 00:41:20 web.novalocal systemd[1]: Started The NGINX HTTP and reverse proxy server.


有大神知道什么原因吗?
2#
发表于 2020-9-23 01:19:02 | 只看该作者
不知道,紫薯布丁,楼下解答
3#
发表于 2020-9-23 01:20:13 | 只看该作者
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红

试下重激活看看

systemctl enable nginx.service
4#
发表于 2020-9-23 01:35:58 | 只看该作者
systemctl enable nginx
reboot
systemctl status nginx
看看啥情况,理论上应该没问题

如果不行,查看log报告
5#
 楼主| 发表于 2020-9-23 01:41:34 | 只看该作者
caddy 发表于 2020-9-23 01:20
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红

试下重激活看看

输入systemctl enable nginx.service后,重启,还是不会自启

6#
 楼主| 发表于 2020-9-23 01:42:39 | 只看该作者
llyang 发表于 2020-9-23 01:35
systemctl enable nginx
reboot
systemctl status nginx

试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?
7#
发表于 2020-9-23 02:22:32 | 只看该作者
检查一下LOG档是否太大 空间满了 也会这样
8#
发表于 2020-9-23 06:29:47 来自手机 | 只看该作者
用军哥的命令管理nginx。
9#
发表于 2020-9-23 08:30:10 | 只看该作者
查看你的nginx配置或网站配置
10#
发表于 2020-9-23 08:53:43 | 只看该作者
yxw886 发表于 2020-9-23 01:42
试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?

如果有这个文件,就是的。

如果没找到这个文件,在.conf中查找这个文件。文件名称、位置,都在这里定义。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-12-11 05:15 , Processed in 0.062538 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表