Help with locations and regex

anon59682 nginx-forum at
Sat Oct 21 17:41:52 UTC 2017


With your suggestions, I was able to get it - thank you! Here is what I
ended up doing:

location = /admin { try_files /index.html =404; }
location ^~ /admin/ { alias /home/user/project/dist/; try_files $uri $uri/
/admin/index.html; }
location = / { # proxy_pass }
location ~ ^/[^/]+$ { # proxy_pass }

The results are perfect. I kinda wanted a single location to handle both
admin cases, but it's not a big deal and the results are more important than
the structure of the config, so I'm okay with it.

Thank you so much, you're the best!

Posted at Nginx Forum:,277012,277016#msg-277016

More information about the nginx mailing list