Running a Reverse Proxy Server with Nginx
In this article I am going to explain how to setup a reverse proxy server with Nginx. But before going into the detail let’s first see what reverse proxy is and what a proxy server is.
What is a proxy server
In computer networks a proxy server is a server that acts as a gateway between the actual webserver and the client. Proxy server is generally used where a large scale of request and response are handled in the network. User configures the proxy server in their browser settings to route all http requests through the proxy server.
Whenever a proxy server gets a request it first checks in its local cache to deliver it, if it does not find in the local cache it sends the request to the actual webserver and sends back the response to the client. Proxy servers are generally handled by ISPs and network administrators.
Why proxy servers are used?
There are several reasons of using proxy server. Some of them are given below.
- To speed up the access to the websites by caching the static pages and static files.
- To control the access to websites by applying some firewall rules.
- To filter the web content or requests/response
- To transform the web content
What is a reverse proxy server
In computer networks a reverse proxy server is a server that retrieves resources form different webservers. In other words a reverse proxy server is a gateway that enables the web server to provide content from different web servers at the background. Reverse proxy servers stand at the front of web server and serve the content either from its cache or by communicating with the backend server. Even you can say that a reverse proxy server is a mirror image of a real website.
Why reverse proxy servers are used?
There are many reasons of using a reverse proxy server and a few of them are given below:
- For load balancing a heavy traffic web server.
- Protecting a backed server from direct expose to the internet.
- Protecting webservers from vulnerable attacks.
- To control the access at large to the servers behind the firewalls.
Reverse proxying with Nginx
Now coming to the point of discussion running Nginx as reverse proxy server, I assume here that you are already familiar with Nginx, the most popular web server. I have prepared a PDF version of the tutorial How to run Nginx as a reverse proxy server. Download this PDF file to know in detail.