NGINX Reverse Proxy
A proxy is a server that resides between internal applications and external clients, forwarding client requests to the appropriate server. An Nginx reverse proxy server is a proxy server that resides behind the firewall in a private network and directs client requests to the appropriate backend server.
A reverse proxy gives an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.
Uses of Reverse Proxy Server
Load - Balancing: A reverse proxy server can act as a traffic cop resides in front of our backend servers and distributing client requests across a group of servers in a manner that increases the speed and capacity utilization while ensuring no one server is overloaded, which can degrade performance. If the server is not up, then the load balancer redirects traffic to the remaining online servers.
Web Acceleration: Nginx reverse proxy is used to compress outbound and inbound data, as well as cache commonly requested content, both of which speed up the flow of traffic between clients and servers.
Security and Anonymity: We can intercept requests of the clients headed for our backend servers, by doing this a reverse proxy server protects their identities and acts as an additional defense against security attacks.
Passing a Request to a Proxied Server
When NGINX server proxies a request, it sends the request to a specified proxied server, fetches the response, and sends it back to the client. It is possible to provide a proxy requests to an HTTP server or a non-HTTP server using a specified protocol. Supported protocols include FastCGI, uwsgi, SCGI, and Memcached.
To pass a request to an HTTP proxied server, the proxy_pass directive is defined inside the location. For example:
To pass a request to a non-HTTP proxied server, use the appropriate **_pass directive: