设为首页收藏本站

简体中文 繁體中文 English 日本語 Deutsch 한국 사람 بالعربية TÜRKÇE português คนไทย Français

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 158|回复: 20

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

[复制链接]

44

主题

141

回帖

502

积分

高级会员

积分
502
发表于 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       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 [=] 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]  [...]
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      send specified signal
Sep 23 00:27:22 web.novalocal kill[1632]: -q, --queue       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 [=] 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.


有大神知道什么原因吗?
回复

使用道具 举报

20

主题

1261

回帖

2620

积分

金牌会员

积分
2620
发表于 2020-9-23 01:19:02 | 显示全部楼层
不知道,紫薯布丁,楼下解答
回复

使用道具 举报

19

主题

360

回帖

815

积分

高级会员

积分
815
发表于 2020-9-23 01:20:13 | 显示全部楼层
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红

试下重激活看看

systemctl enable nginx.service
回复

使用道具 举报

8

主题

223

回帖

520

积分

高级会员

积分
520
发表于 2020-9-23 01:35:58 | 显示全部楼层
systemctl enable nginx
reboot
systemctl status nginx
看看啥情况,理论上应该没问题

如果不行,查看log报告

回复

使用道具 举报

44

主题

141

回帖

502

积分

高级会员

积分
502
 楼主| 发表于 2020-9-23 01:41:34 | 显示全部楼层

caddy 发表于 2020-9-23 01:20

没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红

试下重激活看看

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




回复

使用道具 举报

44

主题

141

回帖

502

积分

高级会员

积分
502
 楼主| 发表于 2020-9-23 01:20:00 | 显示全部楼层

llyang 发表于 2020-9-23 01:35

systemctl enable nginx
reboot
systemctl status nginx

试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?
回复

使用道具 举报

113

主题

135

回帖

689

积分

高级会员

积分
689
发表于 2020-9-23 01:42:39 | 显示全部楼层
检查一下LOG档是否太大 空间满了 也会这样
回复

使用道具 举报

6

主题

244

回帖

578

积分

高级会员

积分
578
发表于 2020-9-23 01:35:00 | 显示全部楼层
用军哥的命令管理nginx。
回复

使用道具 举报

5

主题

72

回帖

179

积分

注册会员

积分
179
发表于 2020-9-23 02:22:32 | 显示全部楼层
查看你的nginx配置或网站配置
回复

使用道具 举报

0

主题

1

回帖

4

积分

新手上路

积分
4
发表于 2020-9-23 06:29:47 | 显示全部楼层

yxw886 发表于 2020-9-23 01:42

试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?

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

如果没找到这个文件,在.conf中查找这个文件。文件名称、位置,都在这里定义。debian系统吗?我遇到这问题,后来折腾不过

换系统好了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Discuz! X

GMT+8, 2026-2-15 23:04 , Processed in 0.015065 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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