NGINX as a Reverse Proxy
[ 88 ]
Summary
We have seen how NGINX can be used as a reverse proxy. Its efficient connection-
handling model is ideal for interfacing directly with clients. After having terminated
requests, NGINX can then open new ones to upstream servers, taking into account
the strengths and weaknesses of each upstream server. Using if inside a location
is only considered valid under certain situations. By thinking about how NGINX
actually handles a request, we can develop a configuration that is more suited to
what we want to achieve. If NGINX cannot reach an upstream server for any reason,
it can serve another page instead. As NGINX terminates the clients' requests, the
upstream servers can obtain information about the client only via headers passed
in NGINX's proxied request. These concepts will help you design an ideal NGINX
configuration to match your needs.
Coming up in the next chapter, we will explore more advanced
reverse-proxy techniques.