So I've made it a thing to finally learn about regular expressions. Normally when working with regular expressions it is necessary to escape delimiters (like "/") with a "\". But when I'm using regular expressions in Nginx it would seem that "/" is treated literally and not as delimiter.
Nginx uses the PCRE engine for evaluating regular expressions, so it makes no sense to me that you can you just throw in an unescaped delimiter without any consequences.
As an example, the below regular expression allows a single IP address and denies all others:
location ~ /\.serverfault {
allow 1.2.3.4;
deny all;
}
But I would think it would need to be like this to work correctly:
location ~ \/\.serverfault {
allow 1.2.3.4;
deny all;
}
What am I missing here?