Nginx: Difference between revisions

imported>Dmo84
added troubleshooting for locations (double escape). fixed the wrong not-doubble escaped example.
imported>Dmo84
m minor wording
Line 69: Line 69:


=== Escape special chars in Regular Expressions ===
=== Escape special chars in Regular Expressions ===
Some nginx configuration options like <code>locations</code> allows using Regular Expressions provided in a string.
Some nginx configuration options like <code>locations</code> allows the use of Regular Expressions.
Be ware that you [https://nixos.org/manual/nix/stable/language/values.html#type-string need to escape some special chars] like <code>\</code>.
Be ware that you [https://nixos.org/manual/nix/stable/language/values.html#type-string need to escape some special chars] like <code>\</code>, if provided by a double quoted <code>" "</code> string.


A common example found in the internet is:
A common example found on the internet is:
<syntaxHighlight>
<syntaxHighlight>
locations."~ ^(.+\.php)(.*)$"  = {
locations."~ ^(.+\.php)(.*)$"  = {