一开始都是正常的,服务器重启nginx还会自动启动,突然今天重启服务器,发现网站打不开了,systemctlstatusnginx,提示
●nginx.service-TheNGINXHTTPandreverseproxyserver
Loaded:loaded(/etc/systemd/system/nginx.service;enabled;vendorpreset:disabled)
Active:failed(Result:exit-code)sinceWed2020-09-2300:27:22CST;1min17sago
Process:1632ExecStop=/bin/kill-sQUIT$MAINPID(code=exited,status=1/FAILURE)
MainPID:1095(code=killed,signal=KILL)
Sep2300:27:22web.novalocalkill[1632]:-q,--queue
Sep2300:27:22web.novalocalkill[1632]:-p,--pid printpidswithoutsignalingthem
Sep2300:27:22web.novalocalkill[1632]:-l,--list[=
Sep2300:27:22web.novalocalkill[1632]:-L,--table listsignalnamesandnumbers
Sep2300:27:22web.novalocalkill[1632]:-h,--help displaythishelpandexit
Sep2300:27:22web.novalocalkill[1632]:-V,--version outputversioninformationandexit
Sep2300:27:22web.novalocalkill[1632]:Formoredetailsseekill(1).
Sep2300:27:22web.novalocalsystemd[1]:nginx.service:controlprocessexited,code=exitedstatus=1
Sep2300:27:22web.novalocalsystemd[1]:Unitnginx.serviceenteredfailedstate.
Sep2300:27:22web.novalocalsystemd[1]:nginx.servicefailed.
使用nginx-t,检查没问题
nginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok
nginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful
输入journalctl-xe,向上翻几页,看到:
Sep2300:27:22web.novalocalsystemd[1]:Starting(null)...
--Subject:Unitselinux.servicehasbegunstart-up
--Defined-By:systemd
--Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
--Unitselinux.servicehasbegunstartingup.
Sep2300:27:22web.novalocalsystemd[1]:nginx.service:mainprocessexited,code=killed,status=9/KILL
Sep2300:27:22web.novalocalkill[1632]:Usage:
Sep2300:27:22web.novalocalkill[1632]:kill[options]<pid|name>[...]
Sep2300:27:22web.novalocalkill[1632]:Options:
Sep2300:27:22web.novalocalkill[1632]:-a,--all donotrestrictthename-to-pidconversiontoprocesses
Sep2300:27:22web.novalocalkill[1632]:withthesameuidasthepresentprocess
Sep2300:27:22web.novalocalkill[1632]:-s,--signal
Sep2300:27:22web.novalocalkill[1632]:-q,--queue
Sep2300:27:22web.novalocalkill[1632]:-p,--pid printpidswithoutsignalingthem
Sep2300:27:22web.novalocalkill[1632]:-l,--list[=
Sep2300:27:22web.novalocalkill[1632]:-L,--table listsignalnamesandnumbers
Sep2300:27:22web.novalocalkill[1632]:-h,--help displaythishelpandexit
Sep2300:27:22web.novalocalkill[1632]:-V,--version outputversioninformationandexit
Sep2300:27:22web.novalocalkill[1632]:Formoredetailsseekill(1).
Sep2300:27:22web.novalocalsystemd[1]:nginx.service:controlprocessexited,code=exitedstatus=1
Sep2300:27:22web.novalocalsystemd[1]:Unitnginx.serviceenteredfailedstate.
Sep2300:27:22web.novalocalsystemd[1]:nginx.servicefailed.
Sep2300:27:22web.novalocalcloud-init[1605]:Cloud-initv.0.7.9runningmodules:finalatTue,22Sep202016:27:22+0000.Up12.09seconds.
Sep2300:27:22web.novalocalsystemd[1]:StartedDynamicSystemTuningDaemon.
--Subject:Unittuned.servicehasfinishedstart-up
--Defined-By:systemd
--Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
--Unittuned.servicehasfinishedstartingup.
--
--Thestart-upresultisdone.
手动输入systemctlstartnginx,可以启动,网站可以正常打开,输入systemctlstatusnginx,提示:
●nginx.service-TheNGINXHTTPandreverseproxyserver
Loaded:loaded(/etc/systemd/system/nginx.service;enabled;vendorpreset:disabled)
Active:active(running)sinceWed2020-09-2300:41:20CST;4sago
Process:1632ExecStop=/bin/kill-sQUIT$MAINPID(code=exited,status=1/FAILURE)
Process:2738ExecStart=/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf(code=exited,status=0/SUCCESS)
MainPID:2739(nginx)
Tasks:5
Memory:82.5M
CGroup:/system.slice/nginx.service
├─2739nginx:masterprocess/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
├─2740nginx:workerprocess
├─2741nginx:workerprocess
├─2742nginx:workerprocess
└─2743nginx:workerprocess
Sep2300:41:20web.novalocalsystemd[1]:StartingTheNGINXHTTPandreverseproxyserver...
Sep2300:41:20web.novalocalsystemd[1]:StartedTheNGINXHTTPandreverseproxyserver.
有大神知道什么原因吗?
-----------------------------------------------------
**网友回复**:
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红
试下重激活看看
systemctlenablenginx.service
网友回复:
systemctlenablenginx
reboot
systemctlstatusnginx
看看啥情况,理论上应该没问题
如果不行,查看log报告
网友回复:
引用:caddy发表于2020-9-2301:20
没看你日志,这样看日志看得眼花,系统直接看,错误部分是可以标红
试下重激活看看
网友回复:
引用:llyang发表于2020-9-2301:35
systemctlenablenginx
reboot
systemctlstatusnginx
网友回复:
引用:yxw886发表于2020-9-2301:42
试过,还是不行,是查看/usr/local/nginx/logs/error.log吗?
网友回复:
看错误日志,看错误日志.
也有可能是nginxpid问题.
看一下端口占用,有时候,nginx已经启动了,
正常使用,但是status还是未启动.
这样的话,可能是pid问题.看一下端口占用,
如果80端口被nginx占用了,那就问题不大
网友回复:
debian系统吗?我遇到这问题,后来折腾不过
换系统好了
网友回复:
启动命令:lnmpnginxstart
网友回复:
引用:1819发表于2020-9-2309:44
看错误日志,看错误日志.
也有可能是nginxpid问题.
看一下端口占用,有时候,nginx已经启动了,
网友回复:
引用:biubiu发表于2020-9-2309:50
debian系统吗?我遇到这问题,后来折腾不过
换系统好了
网友回复:
引用:yxw886发表于2020-9-2310:01
错误日志怎么查看呢?在那个路径呢。80端口没有被占用,nginx进程没找到,每次都是要手动systemctlstart...
网友回复:
引用:mjj不是我发表于2020-9-2309:59
启动命令:lnmpnginxstart
网友回复:
引用:llyang发表于2020-9-2308:53
如果有这个文件,就是的。
如果没找到这个文件,在.conf中查找这个文件。文件名称、位置,都在这里定义...
网友回复:
引用:唐王李世民发表于2020-9-2308:30
查看你的nginx配置或网站配置
网友回复:
引用:yxw886发表于2020-9-2310:11
这样是可以启动,但是每次开机不会自动启动nginx,但mysql、php可以
网友回复:
引用:mjj不是我发表于2020-9-2310:29
那把重启命令放入rc.local。就能开机自启了。
不同的linux系统,rc.local的位置可能不一样。
echo"/etc/...
网友回复:
引用:1819发表于2020-9-2310:08
直接看nginx.conf,看error.log
如果没有配置错误日志,自己再配置.
不看错误日志,很难搞....
网友回复:
引用:yxw886发表于2020-9-2310:31
这个方法试过,但是还是不会开机自启
echo"/etc/init.d/nginxstart">>/etc/rc.local
echo"/usr/loca...
网友回复:
2020/09/2220:33:35[notice]4536#0:signalprocessstarted
这是最后一行,说明没有报错
我也不知道咋整了。
如果是我,重装蒜鸟
网友回复:
引用:llyang发表于2020-9-2313:10
2020/09/2220:33:35[notice]4536#0:signalprocessstarted
这是最后一行,说明没有报错