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...