Nginx reverse proxy failure problem

url

nginx

this is the result of the request. It is found that the request address is still 127.0.0.1. Is there something wrong with it?

Mar.16,2021

location / {} this rule, because there is no = defined as an exact match, so the default fuzzy matching takes effect, and it is in front of it, and the priority is higher than / apis/ , so in fact, the apis rule will never be hit.
the solution is also easy, since your focus is on the apis rule, why put it behind? When configuring, you usually put / at the end of . You only need it to protect the bottom when no other rules are hit. If you put it in front of you, it will be truncated. There is only one configuration item for


proxy?
what about other configurations?


you don't understand what a reverse proxy is. < del > in addition, is it 404 if you directly visit http://epc.epcooo.com:81/recommend.html?category=4? I think there seems to be no problem with the configuration < / del > other guys are right. Nginx matches from top to bottom, and the higher the priority is, the higher the priority is. You should just switch the positions of / and / apis/ to the matching priority after


location. If you server_name localhost, and the following location / or / apis/ is like this, you will start with the first one to find it. No matter how you write url because it is a fuzzy match, if you want to match to apis, then location = / apis/ so that's fine

Menu