linux java 错误日志_linux系统报错日志学习

linux本身会自动记录系统报错日志:/var/log/messages

这个日志记录,我是在什么时候发现其强大的作用的呢?它有点像我们使用php脚本开发接口的时候技术员在重要地方打日志的效果,方便技术人员排错,linux本身也有记录启动相关服务的报错日志。

先贴出我nginx的配置看下

48304ba5e6f9fe08f3fa1abda7d326ab.png

server {

listen 80;

server_name lisiqiong.ttyun.com;

root /data/wwwroot/lisiqiong/demo;

location / {

index index.php index.html index.htm;

}

location ~ .php${

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /usr/local/nginx/conf/fastcgi_params;

}

#access_log /data/wwwlogs/lisiqiong/access.log;

#error_log /data/wwwlogs/lisiqiong/error.log;

}

48304ba5e6f9fe08f3fa1abda7d326ab.png

一般技术员看到这个都会懵掉,因为怎么看都好像没有问题,看官方手册也没有找到问题所在,但是重启nginx服务的时候却报错

[root@Dev_wechat vhost]# service nginx restart

Restarting nginx (via systemctl): Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

[FAILED]

如果有心人去百度,google检索这个错误你会发现很多错误可能都会报这个错哟!那怎么弄呢?懵逼了

最后我仔细的检索发现了牛逼的/var/log/messages这个日志

下面贴错我通过这个查找问题的所在问题

48304ba5e6f9fe08f3fa1abda7d326ab.png

cat /var/log/messages|grep nginx

Feb 16 14:26:35 Dev_wechat nginx: Starting nginx: nginx: [emerg] directive "location" has no opening "{" in /usr/local/nginx/conf/vhost/lisiqiong.ttyun.com.conf:11

Feb 16 14:26:35 Dev_wechat nginx: [FAILED]

Feb 16 14:26:35 Dev_wechat systemd: nginx.service: control process exited, code=exited status=1

Feb 16 14:26:35 Dev_wechat systemd: Unit nginx.service entered failed state.

Feb 16 14:26:35 Dev_wechat systemd: nginx.service failed.

Feb 16 14:26:35 Dev_wechat root: [euid=root]:root pts/0 2017-02-16 09:28 (172.168.6.252):[/usr/local/nginx/conf/vhost]2017-02-16 14:26:34 root service nginx restart

48304ba5e6f9fe08f3fa1abda7d326ab.png

仔细查看日志发现错误报在/usr/local/nginx/conf/vhost/lisiqiong.ttyun.com.conf这个配置文件的11行代码

我靠在看前面的nginx配置发现11就是这行代码

location ~ .php${

你会发现nginx配置中{前面是需要空格的,我晕,最后重启

service nginx restart

一切ok了,就是这么简单,这个日志真的是太有用了,很适合调试服务懵逼时使用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值