What is the tilde (~) doing in an Nginx Location directive? ie:
location ~* \.(png|gif|jpg)$ {
[...configuration]
}
~: The tilde sign is used for case-sensitive regular expression match against a requested URI. ~*: The tilde followed by asterisk sign is used for case insensitive regular expression match against a requested URI.
NGINX Configuration: Understanding Directives. Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx.
By default, NGINX will be installed in /usr/local/nginx . You may change this and other options with the Installation and Compile-Time Options.
It is located in /usr/share/nginx/html. Save this answer.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With