The reverse proxy mechanism

Running Nginx as an application server is somewhat like the FastCGI architecture described in the previous chapter; we are going to be running Nginx as a frontend server, and for the most part, reverse proxy requests to our backend servers.

In other words, it will be in direct communication with the outside world whereas our backend servers, whether Node.js, Apache, and so on, will only exchange data with Nginx:

There are now two web servers running and processing requests:

  • Nginx positioned as a frontend server (in other words, as reverse proxy), receives all the requests coming from the outside world. It filters them, either serving static files directly to the client or forwarding dynamic content requests to our backend server.
  • Our backend backend server only communicates with Nginx. It may be hosted on the same computer as the frontend, in which case, the listening port must be edited to leave port 80 available to Nginx. Alternatively, you can employ multiple backend servers on different machines and load balance between themselves.

To communicate and interact with each other, neither processes will be using FastCGI. Instead, as the name suggests, Nginx acts as a simple proxy server, it receives HTTP requests from the client (acting as HTTP server) and forwards them to the backend server (acting as HTTP client). There is thus no new protocol or software involved. The mechanism is handled by the proxy module of Nginx, as detailed later in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.75.233