Chapter 3. Configuration

There are three main types of 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 routing capabilities. The routing capabilities include routing to Unit applications, serving static files, proxying to external services, and load balancing over a pool of servers. This chapter will build a foundational understanding of these objects.

3.1 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 application’s attributes. Each application type has its own required and optional attributes. A number of different application attributes ...

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.