Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bunch of rewrite rules that I have to port from apache to nginx.

It's a rather painful process because I'm not able to see if my rewrite rules and "if" conditions are working as I want them to.

Apache did have debugging for its rewrite module. Whats can I do for nginx?

share|improve this question
up vote 18 down vote accepted

Enable rewrite_log:

rewrite_log on;

and set debug level in error_log directive:

error_log /var/log/nginx/localhost.error_log notice;
share|improve this answer
so close to Apache ;) I definitely have to take a look at nginx – Olivier Pons Nov 21 '11 at 9:40

Enable debugging support, then set debug level in error_log.

error_log   /var/log/nginx/error.log debug;

Now you can tail the log and send your requests through. There's probably more detail than you want, but that can sometimes be a lifesaver.

Oh, and you should be aware that if is evil, in a location context at least...

share|improve this answer
notice is much better than debug as the error_level for debugging rewrites because it will skip a lot of low-level irrelevant debug info (e.g. SSL or gzip details; 50+ lines per request). – Dan Dascalescu Jul 2 '15 at 11:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.