Three ways to configure NginxThe first method directly replaces the location matching part The second proxy_pass target address does not have a / by default, which means that only the proxy domain name is used, and the url and parameter parts will not change (the requested path is concatenated with the proxy_pass target domain name as the proxy URL) The third type of proxy_pass target address adds a / after it, which means that the part of the path that successfully matches the location is cut off and then spliced into the proxy_pass target address. Location configurationlocation [ = | ~ | ~* | ^~ ] uri {...} The content in square brackets before uri is optional and is explained as follows:
example For example, the following configuration demonstrates the third configuration scheme. When we visit http://44.179.118.54:80/shop/xxx When accessing, Nginx will intercept /shop/ and then concatenate the following path to proxy_pass Then what we actually visit is: http://44.179.118.54:8007/xxx this service #shop-service # Reverse proxy shop-service service location ^~ /shop/ { #proxy_redirect off; #proxy_connect_timeout 60; #proxy_read_timeout 60; #proxy_send_timeout 60; #proxy_buffer_size 4k; #proxy_buffers 4 32k; #proxy_busy_buffers_size 64k; #proxy_temp_file_write_size 64k; #proxy_max_temp_file_size 128m; proxy_pass http://44.179.118.54:8007/; #proxy_set_header X-Real-IP $remote_addr; #root /var/www/test/user/ #index index.html #proxy_pass https://www.baidu.com; } This is the end of this article about Nginx routing forwarding and reverse proxy location configuration implementation. For more related Nginx routing forwarding and reverse proxy content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: Overview and application of position attributes (absolute|relative|static|fixed) in CSS
The automatic scrolling effect of the page can be...
Note: You need to give the parent container a hei...
1. Environmental Preparation Tencent Cloud Server...
In development, it is often necessary to cache th...
Preface When we were writing the horse, I guess e...
Table of contents Global Registration Partial Reg...
Before learning awk, we should have learned sed, ...
This article describes how to compile and install...
The purpose of writing scripts is to avoid having...
Table of contents 10,000 pieces of data were lost...
I hope to implement some properties of the query ...
Table of contents Question: When the button is cl...
This article records the detailed process of down...
Table of contents Preface Global Lock Full databa...
This article example shares the specific code of ...