Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Converting the rewrite rules from Apache to Nginx does not seem to be that difficult
However, I'd like to automate the job, as we are planning to migrate a number of sites.

  • Is there any existing script or tool to perform this operation?
  • If not, are there some specificities in the Apache / Nginx conventions that will make the regular expression conversions harder?
share|improve this question
up vote 1 down vote accepted

One exists, but it's really, really horrible. Your question also shows that you're probably not converting them properly. Where Apache uses rewrite conditions and rewrite rules primarily Nginx uses a combination of location blocks, try_files and rewrite. Many Nginx newbies will put all their rewrite directives into the server block or into a location / block. This means that you're not taking advantage of the hash tables Nginx generates and you will be evaluating all the rewrite rules on each requests - and that's just a waste of CPU cycles.

share|improve this answer

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.