码迷,mamicode.com
首页 > Web开发 > 详细

一个因pid文件丢失,nginx的进程起不来,网站页面无法访问的故事

时间:2018-10-26 16:21:45      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:一个   使用   com   classpath   UNC   proc   报错   3.4   mon   

问题描述:

公司的一个网站首页突然打不开,使用域名访问,页面一片空白。使用IP+端口 访问,界面只能看到几个蓝色的标题,没有图片,排版混乱。

分析解决:

1、查看部署官网的nginx进程,进程已经没有了:
技术分享图片

2、使用systemctl start nginx启动,没有输出报错,但是查看进程依然没有起来。

3、查看/var/log/nginx下面的error.log,发现下面的报错(注意:报错日志里面前面几行报的/home/xx/下面的东西找不到,是代码里面的缺失,网站有三个板块点进去是没有内容的,非服务问题):
技术分享图片

4、查看/var/run/目录,下面已经没有了nginx目录,也没有nginx.pid文件。于是手动创建nginx目录,依然无效。

5、再手动创建nginx.pid文件,并且手动随便写了一个数字进去,再启动nginx,成功,页面访问正常:

[root@master-1 ~]# cd /usr/sbin/
[root@master-1 sbin]# ./nginx 
[root@master-1 sbin]# ps -ef|grep nginx
nginx     6204  6189  0 Mar09 pts/4    00:00:00 /bin/sh -c /bin/bash -x /opt/canal/bin/startup.sh
nginx     7296  6204  0 Mar09 pts/4    00:00:00 /bin/bash -x /opt/canal/bin/startup.sh
nginx     7400  7296  0 Mar09 pts/4    00:09:32 /usr/bin/java -server -Xms2048m -Xmx3072m -Xmn1024m -XX:SurvivorRatio=2 -Xss256k -XX:-UseAdaptiveSizePolicy -XX:MaxTenuringThreshold=15 -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -DappName=otter-canal -Dlogback.configurationFile=/opt/canal/bin/../conf/logback.xml -Dcanal.conf=/opt/canal/bin/../conf/canal.properties -classpath .:/opt/canal/bin/../conf:/opt/canal/bin/../lib/zookeeper-3.4.5.jar:/opt/canal/bin/../lib/zkclient-0.1.jar:/opt/canal/bin/../lib/spring-2.5.6.jar:/opt/canal/bin/../lib/slf4j-api-1.7.12.jar:/opt/canal/bin/../lib/protobuf-java-2.6.1.jar:/opt/canal/bin/../lib/oro-2.0.8.jar:/opt/canal/bin/../lib/netty-all-4.1.6.Final.jar:/opt/canal/bin/../lib/netty-3.2.5.Final.jar:/opt/canal/bin/../lib/logback-core-1.1.3.jar:/opt/canal/bin/../lib/logback-classic-1.1.3.jar:/opt/canal/bin/../lib/log4j-1.2.14.jar:/opt/canal/bin/../lib/jcl-over-slf4j-1.7.12.jar:/opt/canal/bin/../lib/guava-18.0.jar:/opt/canal/bin/../lib/fastjson-1.2.28.jar:/opt/canal/bin/../lib/commons-logging-1.1.1.jar:/opt/canal/bin/../lib/commons-lang-2.6.jar:/opt/canal/bin/../lib/commons-io-2.4.jar:/opt/canal/bin/../lib/commons-beanutils-1.8.2.jar:/opt/canal/bin/../lib/canal.store-1.0.24.jar:/opt/canal/bin/../lib/canal.sink-1.0.24.jar:/opt/canal/bin/../lib/canal.server-1.0.24.jar:/opt/canal/bin/../lib/canal.protocol-1.0.24.jar:/opt/canal/bin/../lib/canal.parse.driver-1.0.24.jar:/opt/canal/bin/../lib/canal.parse.dbsync-1.0.24.jar:/opt/canal/bin/../lib/canal.parse-1.0.24.jar:/opt/canal/bin/../lib/canal.meta-1.0.24.jar:/opt/canal/bin/../lib/canal.instance.spring-1.0.24.jar:/opt/canal/bin/../lib/canal.instance.manager-1.0.24.jar:/opt/canal/bin/../lib/canal.instance.core-1.0.24.jar:/opt/canal/bin/../lib/canal.filter-1.0.24.jar:/opt/canal/bin/../lib/canal.deployer-1.0.24.jar:/opt/canal/bin/../lib/canal.common-1.0.24.jar:/opt/canal/bin/../lib/aviator-2.2.1.jar: com.alibaba.otter.canal.deployer.CanalLauncher
root     26114     1  0 10:07 ?        00:00:00 nginx: master process ./nginx
nginx    26115 26114  0 10:07 ?        00:00:00 nginx: worker process
root     26164 19128  0 10:08 pts/2    00:00:00 grep --color=auto nginx

然后PID文件也正常了。

[root@master-1 sbin]# cat /var/run/nginx/nginx.pid 
26114
[root@master-1 sbin]# 

重新刷新网站首页,页面恢复正常。

一个因pid文件丢失,nginx的进程起不来,网站页面无法访问的故事

标签:一个   使用   com   classpath   UNC   proc   报错   3.4   mon   

原文地址:http://blog.51cto.com/10950710/2309265

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!