53

What is the meaning of the tilde after the location block in the nginx configuration?

for example

location ~ ^/download/(.*)$ {
  alias /home/website/files/$1;
}

What is the difference between with and without the "~" ?

60

The tilde instructs nginx to perform a case-sensitive regular expression match, instead of a straight string comparison.

More details in the docs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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