nginx重写错误的调试

2012 from—http://www.144d.com/post-203.html

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

1rewrite_log on;   # 打开 URL 重写模块的日志开关,以便写入 error_log

另外error_log最后那个参数还需要设置成Info.如下:

1error_log /home/www/logs/nginx_error.log info;

lnmp的集成包,默认设置的是:

1error_log /home/www/logs/nginx_error.log crit;

并且没有开启rewrite_log on选项,所以重写错误时无法查看错误内容。

 

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

 

01.168.0.39, request: "GET /default/view/editsort/sort-5-aid-8876.html HTTP/1.1", host: "192.168.0.39:8080"
022012/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"
032012/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"
042012/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"
052012/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"
062012/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"
072012/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"
082012/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"
092012/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"
102012/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"
112012/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"
122012/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"
132012/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"
142012/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"
152012/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"
162012/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"
17[root@localhost vhost]#

上一篇
下一篇