Proxy forwarding rulesWhen configuring location proxy forwarding rules in nginx, different writing methods correspond to different forwarding rules. If proxy_pass uses a URI, when the request is transmitted to the backend server, the matching part of the normalized request path and the path in the configuration will be replaced by the URI defined in the directive (corresponding to the first case below). If proxy_pass is not used with a URI, the request URI sent to the backend server is generally the original URI initiated by the client (the second case below). Access address: http://localhost/proxy/abc.html Here are some common matching scenarios: The first one:location /proxy/ { proxy_pass http://127.0.0.1:8080/; } Proxy to: http://127.0.0.1:8080/abc.html Second type:location /proxy/ { proxy_pass http://127.0.0.1:8080; } Compared with the first proxy_pass, it lacks / The third type:location /proxy/ { proxy_pass http://127.0.0.1:8080/api/; } Proxy to: http://127.0.0.1:8080/api/abc.html The fourth type:location /proxy/ { proxy_pass http://127.0.0.1:8080/api; } Less than the third type/ location /proxy { proxy_pass http://127.0.0.1:8080/api; } Proxy to: http://127.0.0.1:8080/api/abc.html Fifth:location /proxy { proxy_pass http://127.0.0.1:8080/; } Proxy to: http://127.0.0.1:8080//abc.html location /proxy { proxy_pass http://127.0.0.1:8080; } Proxy to: http://127.0.0.1:8080/proxy/abc.html Here is an explanation from the official documentation: NGINX-httpproxy module official documentation Chinese documentation translated by Alibaba tengine - recommended reading This is the end of this article about the various uses of proxy_pass in nginx. For more relevant content on the use of nginx proxy_pass, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: CSS3 realizes bouncing ball animation
>>: html opens a new window with a hyperlink and can control window properties
This article shares the specific code of Vue to a...
Table of contents Preliminary preparation Deploym...
There are many tags and elements in the HTML head ...
If you’re looking for inspiration for columnar web...
I installed a Linux Ubuntu system on my computer....
Use event delegation to implement message board f...
Since I often install the system, I have to reins...
Table of contents The first The second Native Js ...
background: As a DBA, most of the DDL changes of ...
Preface In the MySQL database, sometimes we use j...
Keywords General The title cannot contain words l...
For work needs, I found a lot of information on t...
Native JS implements the click number game for yo...
There are many MySQL variables, some of which are...
question: <input type="hidden" name=...