Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Oct 232011
 

Debug Nginx configuration using the echo module

Answer:

When you want to confirm you have configured Nginx correctly, e.g. make sure you have the right rewrite rules. The easiest way is to use the echo module to debug.

E.g.

..
location / {
    rewrite ^/foo /bar break;
    echo $uri; # try with other variables you want to trace
}

When you use curl to request the page, you should receive something like:

# curl http://example.com/foo
bar

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>