12

What is the tilde (~) doing in an Nginx Location directive? ie:

location ~* \.(png|gif|jpg)$ {
  [...configuration]
}
1

1 Answer 1

27

The tilde (~) is an identifier for Nginx letting it know that the location block is using a REGEX to match the location.

"~" = REGEX match, case-sensitive

"~*" = REGEX match, case-insensitive

Nginx Docs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.