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

Introduction

There are three main configuration objects used by NGINX Unit. All are defined with JSON. The application object defines characteristics of the application being run by Unit, such as the language, the process controls, and the location on the filesystem. The listener object defines the Unit configuration that directs incoming requests on a defined IP address and port to a specified application. The route objects provide internal routing capabilities. This chapter will build a foundational understanding of these objects.

Application Object

Problem

You need to understand the application object for a fundamental understanding of NGINX Unit.

Solution

Define an application object that describes an application on the system. Each application type has different attributes and options that can be applied. The following is a basic example of a PHP application object:

{
    "applications": {
        "my-app": {
            "type": "php",
            "processes": 2,
            "root": "/var/www/app/",
            "index": "index.php",
            "user": "app_user",
            "group": "app_group"
        }
    }
}

Discussion

Every application deployed on NGINX Unit is defined by an application object. The application object, defined in JSON, specifies the attributes of the application. Each application type has its own required and optional attributes. A number of different application attributes control Unit process management and limitation. The type attribute is the only process management attribute that is required for an application; ...

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