Mastering Nginx

(Ron) #1

Reverse Proxy Advanced Topics


[ 98 ]

Due to its very low resource usage, NGINX acts ideally as the broker in a client-


application relationship. NGINX handles the connection to the client, able to process
multiple requests simultaneously. Depending on the configuration, NGINX will


either deliver a file from its local cache or pass the request on to an upstream server
for further processing. The upstream server can be any type of server that speaks


the HTTP protocol. More client connections can be handled than if an upstream


server were to respond directly:


upstream app {

server 10.0.40.10;

server 10.0.40.20;

server 10.0.40.30;

}

Over time, the initial set of upstream servers may need to be expanded. The traffic to
the site has increased so much, that the current set can't respond in a timely enough


manner. By using NGINX as the reverse proxy, this situation can easily be remedied
by adding more upstream servers.


Adding more upstream servers can be done as follows:


upstream app {

server 10.0.40.10;

server 10.0.40.20;
Free download pdf