11

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

location ~* \.(png|gif|jpg)$ {
  [...configuration]
}
Cory Robinson
  • 4,616
  • 4
  • 36
  • 53

1 Answers1

25

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

Cory Robinson
  • 4,616
  • 4
  • 36
  • 53