2021年2月10日星期三

nginx not matching very simple location

I have a stupid simple nginx configuration, and when run through https://nginx.viraptor.info/ it matches correctly. In production, however, I can't get location to match.

I'm trying to have the root of the site www.site.com AND www.site.com/company/our-story match and proxy to another server. Problem is root matches and /company does not.

My config snippet is here

Matches https://currentsite.com and redirects to https://differentsite.com

Does NOT match https://currentsite.com/company OR https://currentsite.com/comany/our-story on the "location /company" block like I expect. Instead falls through and doesn't direct.

   location = / {         proxy_pass https://differentsite.com/;         proxy_set_header Host differentsite.com;      }        location /company {         proxy_pass https://differentsite.com/company;         proxy_set_header Host differentsite.com;      }        location / {        try_files $uri $uri/ /index.html;      }  

This must be the simplest location nginx question but I can't seem to make it work in actual production scenario.

Thanks

https://stackoverflow.com/questions/66148199/nginx-not-matching-very-simple-location February 11, 2021 at 11:06AM

没有评论:

发表评论