Restricting access to specific subdirectories

Jonathan Matthews contact at
Sun Feb 3 11:53:09 UTC 2013

On 3 February 2013 03:27, jdiana <nginx-forum at> wrote:
>         location ~ ^/my_ws$ {
> However, if there's anything AFTER that (i.e. my_ws/, my_ws/page2,
> my_ws?parameter1, etc.) it allows them to proceed regardless of IP.
> I'm sure it's something required before or after the $, but I can't figure
> it out.

Your problem is absolutely to do with the "$", and if you don't yet
understand regex well enough to fix it, have a read through a simple
intro such as

BTW that's a pointer to the exact section you need, but I recommend
you digest at least the first half of that guide - it's not long or
difficult, and will serve you well in the future.

Jonathan Matthews // Oxford, London, UK

More information about the nginx mailing list