0

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?
Kevin Worthington
  • 327
  • 2
  • 6
  • 19
Déjà vu
  • 5,408
  • 9
  • 32
  • 52

1 Answers1

1

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.

Kevin Worthington
  • 327
  • 2
  • 6
  • 19
Martin Fjordvald
  • 7,589
  • 1
  • 28
  • 35