When deploying nginx as a Reverse Proxy, at this time nginx will operate between the client and the server.
When a request from the client to the server is received, this request will be received by nginx and nginx will route the request to the pre-configured BE, and when the BE responds, it will also go through nginx to send the result back to the server.
Setting up a reverse proxy will help hide BE information, and thanks to that, server switching is also easier.
To deploy nginx Reverse Proxy, we will need the help of the proxy_pass directive
Please refer to the following example
events {
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
server_name nginx.test;
location / {
proxy_pass "https://nginx.org/";
}
}
}
And now, when we access the url http://nginx.test, the system will access and display the content of https://nginx.org without changing the URL of the browser.