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; ...

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.