troubleshoot rewrite log

Maxim Dounin mdounin at mdounin.ru
Thu Dec 10 15:57:18 MSK 2009


Hello!

On Thu, Dec 10, 2009 at 05:37:04PM +0500, Ziyad Saeed wrote:

> Where do you use that directive. Under the HTTP block its giving me no
> errors

It's allowed in http, server, if in server, location, if in location 
contexts.

With the following config

    error_log  /path/to/error_log  notice;
    rewrite_log on;

    server {
        listen 8080;
        server_name zzz;
        rewrite ^ /blah break;
    }

you should see something like this in error_log:

2009/12/10 15:50:19 [notice] 12343#0: *1 "^" matches "/", client: 127.0.0.1, server: zzz, request: "GET / HTTP/1.0"
2009/12/10 15:50:19 [notice] 12343#0: *1 rewritten data: "/blah", args: "", client: 127.0.0.1, server: zzz, request: "GET / HTTP/1.0"

If you don't see such messages - either you have no rewrites 
defined in matching server{} block, or your set logging level 
higher than notice.

Maxim Dounin

p.s. Please do not top-post.  Thank your.

> 
> On Thu, Dec 10, 2009 at 3:41 AM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> 
> > Hello!
> >
> > On Wed, Dec 09, 2009 at 09:22:32PM +0500, Ziyad Saeed wrote:
> >
> > > is there a rewrite log file that shows what is the rewrite engine doing,
> > > what is it trying to match and failing etc
> >
> > rewrite_log on;
> >
> > With this settings basic rewrite information will be logged to
> > error_log at notice level.
> >
> > Maxim Dounin
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >

> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list