nginx error.log


nginx.conf里会有两个日志,分为access.log 和 error.log。其中这两个日志可以细化,一般来说在nginx目录下会有一个logs会保存,然后也可以在对应的server目录里可以分别的设定access.log和error.log来了解对应server的情况。

access.log主要是记录"谁来登陆了,从哪里登陆的,登陆后发生了什么",具体格式可以在nginx.conf里设定。

error.log主要记录的是检查nginx.conf里发现的错误,比如:

“2016/05/03 10:20:51 [emerg] 20952#0: unexpected "}" in /usr/local/nginx/conf/nginx.conf:87”

这句话就说明在nginx.conf的87行里有一个 } 是错误的,这个错误的级别是emergency;

2016/05/03 10:23:01 [emerg] 21023#0: "root" directive is duplicate in /usr/local/nginx/conf/nginx.conf:86

这句话就是说明在nginx.conf的第86行里root设定重复了,级别同样是emergency。以上两个都是书写的问题,很好纠正;

2016/05/03 10:23:31 [notice] 21045#0: signal process started

这个意思是nginx已经在运行的状态下,被执行启动,这个不算致命错误;

nginx: [alert] could not open error log file: open()"/usr/local/nginx/logs/error.log" failed (13:Permissiondenied)

这个是说当前用户没有权限写入error.log的日志,解决方法要来权限就行了;

nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

nginx提示无法找到nginx.pid这个文件了,使用#/usr/local/nginx/sbin/nginx -c  /usr/local/nginx/conf/nginx.conf,重新启动一下,就自动生成pid文件了。

下面说几个有特殊代表性的错误:

1)worker process 某某某 exited on signal 11 (core dumped)  
这种错误基本就是刷error.log的屏,严重的甚至直接让nginx崩掉。具体表现在用户端就是“视频打不开,网页打不开等等等”。

这种错误一般是表示用户程序nginx进行读操作时访问的地址无效,具体一点就是搜索引擎的蜘蛛在爬取到加密部分时,得不到正确的路径,又没有被定位到错误页导致的。

如何修改,在nginx.conf里的防盗链部分检查一下“secure_download_fail_location;” ,即“请求错误时,定向到错误页”的模块,确认location是否定向到一个正确地址为错误页面。

2)nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)   

nginx先监听了ipv4的80端口之后又监听了ipv6的80端口,于是就重复占用了。

把nginx.conf里的:

listen 80;
listen [::]:80 default_server;

改成

listen 80;
listen [::]:80 ipv6only=on default_server;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值