How to exact match a nginx location?

Alex Samad alex at samad.com.au
Tue Mar 28 04:07:57 UTC 2017


so (have a stab at this)

location = /mini {


equals

http://10.21.169.13/mini and not  http://10.21.169.13/mini/ or anything else
 http://10.21.169.13/mini/*


try

location /mini {

or

location  /mini/ {


A


On 28 March 2017 at 12:43, Jun Chen via nginx <nginx at nginx.org> wrote:

>
> I am configuring a nginx revser proxy. The result should be when user type
> http://10.21.169.13/mini, then the request should be proxy_pass to
> 192.168.1.56:5000. Here is the nginx config:
>
> server {
>         listen 80;
>         server_name 10.21.169.13;
>
>         location = /mini {
>                 proxy_pass http://192.168.1.65:5000;
>                 include /etc/nginx/proxy_params;
>         }
> }
>
> The above location block never worked with http://10.21.169.13/mini. The
> only location block worked is:
>
> server {
>         listen 80;
>         server_name 10.21.169.13;
>
>         location  / {
>                 proxy_pass http://192.168.1.65:5000;
>                 include /etc/nginx/proxy_params;
>         }
> }
>
> But the above config also match http://10.21.169.13 request which is too
> board.
> What kind of location block will only match 'http://10.21.169.13/mini`
> and no more?
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170328/e5c1d457/attachment-0001.html>


More information about the nginx mailing list