1. The difference between forward proxy and reverse proxy A forward proxy acts as a proxy for the client, and a reverse proxy acts as a proxy for the server. 1.1 Forward Proxy A forward proxy server is located between the client and the server. In order to obtain data from the server, the client sends a request to the proxy server and specifies the target server. The proxy server then forwards the data returned by the target server to the client. Here the client needs to make some forward proxy settings. Example: Climbing the Wall In a forward proxy, the client's request is proxied 1.2 Reverse Proxy In the reverse proxy, the client is unaware of the proxy and can access it without any configuration. The client sends the request to the reverse proxy server, which selects the target server to obtain the data and then returns it to the client. At this time, the reverse proxy server and the target server are one server to the outside world. What is exposed is the proxy server address, and the real server IP address is hidden. 2. Use of nginx reverse proxy Create a new virtual host configuration in the nginx configuration file nginx.conf, server { listen 8080; server_name localhost; location /category/ { proxy_pass http://localhost; } } In the above configuration, listen indicates the port that nginx will listen on; server_name is the domain name entered in the browser when accessing nginx. You can directly fill in the IP address. If you want to bind multiple, you can separate them with spaces; location indicates the URL to be matched when nginx listens to the port. If the URL accessing nginx contains /category/, the proxy is executed. proxy_pass indicates the target to which nginx will proxy the client's request. Note the path writing of proxy_pass here. If the path ends without / as above, it means a relative path. Then nginx will not intercept /category/ in the original URL when forwarding the request. For example, if the browser accesses http://localhost:8080/category/findAll, the request address actually sent by nginx is http://localhost/category/findAll. If the target path of proxy_pass is configured with a / at the end, indicating an absolute path, then nginx will intercept the /category/ in the original URL when forwarding the request. For example, if the browser accesses http://localhost:8080/category/findAll, the request address actually sent by nginx is http://localhost/findAll. When configuring, you need to decide whether to include / according to your needs, otherwise nginx will always report a 404 error in actual use. My configuration here contains /category in my backend interface path, so I use a relative path and keep this. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: js realizes horizontal and vertical sliders
>>: MySQL 8.0.18 installation and configuration method graphic tutorial
The default number of remote desktop connections ...
Prepare a CentOS6 installation disk (any version)...
Table of contents 1. What is a doubly linked list...
Use the system crontab to execute backup files re...
When the token expires, refresh the page. If the ...
Table of contents 1. Conditions for joint index f...
"Development is more than just writing code&q...
Table of contents 1. List interface display examp...
In the latest version of Ubuntu, users no longer ...
1. Download Dependency npm install @antv/data-set...
Preface This article mainly introduces the method...
1. Go to the official website: D:\mysql-5.7.21-wi...
Preface I believe everyone knows that indexes are...
In rows, dark border colors can be defined indivi...
Worms replicate, as the name implies, by themselv...