折雨的天空

新浪微薄腾讯微薄

最新碎语:最近霉到了住。哎。。。

您的位置:折雨的天空 >其他技术> nginx重写错误的调试

nginx重写错误的调试

用以下代码在Nginx的配置文件中打开重写错误日志提示。

rewrite_log on;   # 打开 URL 重写模块的日志开关,以便写入 error_log
另外error_log最后那个参数还需要设置成Info.如下:

error_log /home/www/logs/nginx_error.log info;
lnmp的集成包,默认设置的是:

error_log /home/www/logs/nginx_error.log crit;
并且没有开启rewrite_log on选项,所以重写错误时无法查看错误内容。

 

一下为重写出现错误时的一些日志,仅供参考:

 

.168.0.39, request: "GET /default/view/editsort/sort-5-aid-8876.html HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:40 [notice] 4145#0: *5 rewritten data: "/index.php", args: "ct=default&m=error", client: 192.168.0.188, server: 192.168.0.39, request: "GET /default/view/editsort/sort-5-aid-8876.html HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)-([a-z0-9_]+)-([^/-]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [error] 4145#0: *5 open() "/home/wwwroot/www.meiyoule.com/favicon.ico" failed (2: No such file or directory), client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)\.html$" matches "/error.html", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 rewritten data: "/index.php", args: "ct=default&m=error", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)/([^/]+)/([a-z0-9_]+)-([^/-]+)-([a-z0-9_]+)-([^/-]+)\.html$" does not match "/favicon.ico", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [error] 4145#0: *5 open() "/home/wwwroot/www.meiyoule.com/favicon.ico" failed (2: No such file or directory), client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 "^/([^/]+)\.html$" matches "/error.html", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
2012/12/25 14:46:42 [notice] 4145#0: *5 rewritten data: "/index.php", args: "ct=default&m=error", client: 192.168.0.188, server: 192.168.0.39, request: "GET /favicon.ico HTTP/1.1", host: "192.168.0.39:8080"
[root@localhost vhost]#

------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------

转载请注明本文标题和链接:《nginx重写错误的调试

奖励一下

取消

分享不易,烦请有多多打赏,如您也困难,点击右边关闭即可!

扫码支持
扫码打赏,5元,10元,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

-秒后自动关闭,如已打赏,或者不愿打赏,请点击右上角关闭图标。

发表评论

路人甲 表情
看不清楚?点图切换