O'Reilly logo

NGINX Unit Cookbook by Derek DeJonghe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Ecosystem Integration

Introduction

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.

Reverse Proxying to Unit Applications Through NGINX

Problem

You need to serve an application running in NGINX Unit through a 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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required