Chapter 7. Ecosystem Integration
Throughout this chapter, you will learn about operational integration as it pertains to NGINX Unit. Unit applications may need to be served via an NGINX proxy or load balancer, to which the configuration will be detailed. Also included are recipes that enable you to securely expose the Unit control interface through NGINX. Other topics include running Unit within a container and deploying application version upgrades through the control API.
7.1 Reverse Proxying to Unit Applications Through NGINX
Problem
You need to serve an application running in NGINX Unit through an NGINX server acting as a reverse proxy or load balancer.
Solution
Configure an upstream
block in the NGINX configuration made up of Unit servers:
upstream unit_backend { server 127.0.0.1:8080; # Local Reverse Proxy server 10.0.0.12:8080; # Remote Server Load Balance server 10.0.1.12:8080; # Remote Server Load Balance }
Configure a server
block within the NGINX configuration to proxy requests to the upstream
server set:
server { # Typical NGINX server setup and security directives location / { # NGINX Proxy Settings proxy_pass http://unit_backend; } }
Discussion
The NGINX web server and reverse proxy load balancer is a fully dynamic application gateway. It can be used as a web server, reverse proxy, load balancer, and more. For brevity, this recipe assumes that the NGINX server
block has been configured with the necessary required and security-concerned directives.
In a ...
Get NGINX Unit Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.