Docs / Web Servers / How to Set Up Nginx Unit Application Server

How to Set Up Nginx Unit Application Server

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 26 views · 2 min read

What Is Nginx Unit?

Nginx Unit is a dynamic application server that supports multiple languages including PHP, Python, Go, and Node.js. It uses a RESTful JSON API for configuration, allowing you to update settings and deploy applications on your Breeze without restarts or downtime.

Prerequisites

  • A Breeze running Ubuntu 22.04 or later
  • Root or sudo access

Step 1: Install Nginx Unit

curl --output /usr/share/keyrings/nginx-keyring.gpg https://unit.nginx.org/keys/nginx-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ $(lsb_release -cs) unit" | sudo tee /etc/apt/sources.list.d/unit.list
sudo apt update
sudo apt install unit unit-php unit-python3.11

Step 2: Start the Service

sudo systemctl enable unit
sudo systemctl start unit

Step 3: Deploy a PHP Application

Create a JSON configuration file:

sudo nano /tmp/app-config.json
{
    "listeners": {
        "*:8080": {
            "pass": "applications/myapp"
        }
    },
    "applications": {
        "myapp": {
            "type": "php",
            "root": "/var/www/myapp/public",
            "index": "index.php"
        }
    }
}

Step 4: Apply the Configuration

sudo curl -X PUT --data-binary @/tmp/app-config.json \
  --unix-socket /var/run/control.unit.sock \
  http://localhost/config

Step 5: Verify the Deployment

curl http://localhost:8080

Check the current running configuration at any time:

sudo curl --unix-socket /var/run/control.unit.sock http://localhost/config

Key Advantages

  • Zero-downtime configuration changes via the API
  • Run multiple language runtimes side by side on one Breeze
  • Lightweight process model with low memory overhead
  • Pair with Nginx as a reverse proxy for SSL termination in production

Was this article helpful?