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
There are two ways to expose container ports in d...
To put it simply, the IP of the virtual machine u...
This article shares the specific code of vue+echa...
There are many commands used in the system, so ho...
Table of contents HTTP hijacking, DNS hijacking a...
The following code introduces MySQL to update som...
cause The reason for writing this blog is that I ...
Table of contents Preface Configure yum source, e...
ab command principle Apache's ab command simu...
This article describes how to set the automatic c...
Table of contents 1. Component bloat 2. Change th...
Table of contents 1. Modify by binding the style ...
text 1) Download the Ubuntu image docker pull ubu...
In development, it is often necessary to cache th...
First, start MySQL in skip-grant-tables mode: mys...