FreeUnit

Installation§

Warning

FreeUnit has no APT or YUM package repository yet. FreeUnit releases have .deb packages for Debian 13 (trixie) on amd64 as release assets. Other install paths are Docker images, source builds, and pre-built unitctl binaries from GitHub Releases. The packages.nginx.org/unit/* repositories described below belong to the archived NGINX Unit project and will not receive further updates — use them only to migrate off. See the Migration guide for the current install paths and for maintainer instructions on rebasing community packages.

You can install FreeUnit in four alternative ways:

Note

The commands in this document starting with a hash (#) must be run as root or with superuser privileges.

Prerequisites§

Unit compiles and runs on various Unix-like operating systems, including:

  • FreeBSD 10 or later
  • Linux 2.6 or later
  • macOS 10.7 or later
  • Solaris 11

It also supports most modern instruction set architectures, such as:

  • ARM
  • IA-32
  • PowerPC
  • MIPS
  • S390X
  • x86-64

App languages and platforms that Unit can run (including several versions of the same language):

  • Go 1.6 or later
  • Java 8 or later
  • Node.js 8.11 or later
  • PHP 5, 7, 8
  • Perl 5.12 or later
  • Python 2.6, 2.7, 3
  • Ruby 2.0 or later
  • WebAssembly Components WASI 0.2

Optional dependencies:

  • OpenSSL 1.1.1 or later for TLS support
  • PCRE (8.0 or later) or PCRE2 (10.23 or later) for regular expression matching
  • The njs scripting language
  • Wasmtime for WebAssembly Support

Official packages§

Warning

FreeUnit has no RPM or DEB package repository yet. FreeUnit publishes .deb packages for Debian 13 (trixie) as release assets. The other repositories, keys, and package names documented in this section (packages.nginx.org/unit/*, nginx-keyring.gpg, unit, unit-php, …) refer to the archived NGINX Unit project and are kept here for reference only. On other systems, install via Docker or a source build.

Historically, official precompiled Unit binary packages have been available for:

The packages include core executables, developer files, and support for individual languages. We also maintain a Homebrew tap for macOS users and a module for Node.js at the npm registry.

Note

For details of packaging custom modules that install alongside the official Unit, see here.

Repo installation script

Warning

This script targets the archived NGINX Unit repositories (packages.nginx.org/unit/*) and is not compatible with FreeUnit. Use the manual steps below for each distribution, or install via Docker / source build.

The original script is archived at github.com/nginx/unit/tree/master/tools for reference only.

Amazon Linux§

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/amzn/2023/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # yum install unit
    
    # yum install unit-devel unit-jsc17 unit-perl  \
          unit-php unit-python39 unit-python311 unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/amzn2/$releasever/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # yum install unit
    
    # yum install unit-devel unit-jsc8 unit-perl  \
          unit-php unit-python27 unit-python37 unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

Warning

Unit’s 1.22+ packages aren’t built for Amazon Linux AMI. This distribution is obsolete; please update.

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/amzn/$releasever/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # yum install unit
    
    # yum install unit-devel unit-jsc8 unit-perl unit-php  \
          unit-python27 unit-python34 unit-python35 unit-python36
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

Debian§

Supported architecture: x86-64.

FreeUnit has no apt repository yet. The .deb packages for Debian 13 (trixie) are assets of a FreeUnit release on GitHub. Install the freeunit package and one language module. The PHP embed SAPI allows only one PHP version in one Unit instance.

  1. Install the tools that download and check the packages:

    # apt-get update
    
    # apt-get install -y --no-install-recommends ca-certificates curl
    
  2. To install a PHP module, enable the deb.sury.org repository. The PHP modules depend on libphpX.Y-embed from that repository. Skip this step if you install only the Python module.

    # curl -fsSL https://packages.sury.org/php/apt.gpg  \
           -o /usr/share/keyrings/sury-php.gpg
    

    Create the following file named /etc/apt/sources.list.d/sury-php.sources:

    Types: deb
    URIs: https://packages.sury.org/php/
    Suites: trixie
    Components: main
    Signed-By: /usr/share/keyrings/sury-php.gpg
    
    # apt-get update
    
  3. Download the packages and the SHA256SUMS file, check the packages, and install them:

    $ DEB=1.37.2-1~trixie    # Version as it appears in the SHA256SUMS file names
    $ ASSET=1.37.2-1.trixie  # The same version in the asset URLs
    $ MOD=php8.4
    $ BASE=https://github.com/freeunitorg/freeunit/releases/download/1.37.2
    
    $ curl -fLO "$BASE/SHA256SUMS"
    $ curl -fL -o "freeunit_${DEB}_amd64.deb" "$BASE/freeunit_${ASSET}_amd64.deb"
    $ curl -fL -o "freeunit-${MOD}_${DEB}_amd64.deb" "$BASE/freeunit-${MOD}_${ASSET}_amd64.deb"
    
    $ sha256sum -c --ignore-missing SHA256SUMS
    
    $ sudo apt-get install -y "./freeunit_${DEB}_amd64.deb" "./freeunit-${MOD}_${DEB}_amd64.deb"
    

    GitHub replaces ~ with . in the name of a release asset. The curl commands save each file under the name that SHA256SUMS lists. sha256sum -c --ignore-missing checks only the files that you downloaded. It fails if a digest does not match. SHA256SUMS proves integrity only. It does not prove who made the files.

  4. Start Unit:

    # systemctl enable --now freeunit
    
    # systemctl status freeunit
    

The release also has -dbg packages with debug symbols and a freeunit-dev package.

Runtime details:

Daemon binary and service /usr/sbin/freeunitd, freeunit
Control socket /var/run/control.freeunit.sock
Log file /var/log/freeunit.log
Non-privileged user and group freeunit

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/debian/ bookworm unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/debian/ bookworm unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-jsc17 unit-perl  \
          unit-php unit-python3.11 unit-ruby unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/debian/ bullseye unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/debian/ bullseye unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-jsc11 unit-perl  \
          unit-php unit-python2.7 unit-python3.9 unit-ruby unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Fedora§

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/fedora/$releasever/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # dnf install unit
    # dnf install unit-devel unit-jsc17 unit-perl  \
          unit-php unit-python312 unit-ruby
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

RHEL and derivatives§

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/rhel/$releasever/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # yum install unit
    
    # yum install unit-devel unit-go unit-jsc8 unit-jsc11  \
          unit-perl unit-php unit-python39 unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

Supported architecture: x86-64.

  1. To configure Unit’s repository, create the following file named /etc/yum.repos.d/unit.repo:

    [unit]
    name=unit repo
    baseurl=https://packages.nginx.org/unit/rhel/$releasever/$basearch/
    gpgkey=https://unit.nginx.org/keys/nginx-keyring.gpg
    gpgcheck=1
    enabled=1
    
  2. Install the core package and other packages you need:

    # yum install unit
    
    # yum install unit-devel unit-jsc8 unit-jsc11  \
          unit-perl unit-php unit-python27 unit-python36 unit-python38 unit-python39 unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit

Note

Use these steps for binary-compatible distributions: AlmaLinux, CentOS, Oracle Linux, or Rocky Linux.

Ubuntu§

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ noble unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ noble unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-go unit-jsc11 unit-jsc17 unit-jsc21 \
                  unit-perl unit-php unit-python3.12 unit-ruby unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ jammy unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ jammy unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-go unit-jsc11 unit-jsc16 unit-jsc17 unit-jsc18  \
                  unit-perl unit-php unit-python2.7 unit-python3.10 unit-ruby unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ focal unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ focal unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-jsc11 unit-perl  \
          unit-php unit-python2.7 unit-python3.8 unit-ruby unit-wasm
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Warning

Unit’s 1.31+ packages aren’t built for Ubuntu 18.04. This distribution is obsolete; please update.

Supported architectures: arm64, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ bionic unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ bionic unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-jsc8 unit-jsc11 unit-perl  \
          unit-php unit-python2.7 unit-python3.6 unit-python3.7 unit-ruby
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

Warning

Unit’s 1.24+ packages aren’t built for Ubuntu 16.04. This distribution is obsolete; please update.

Supported architectures: arm64, i386, x86-64.

  1. Download and save NGINX’s signing key:

    # curl --output /usr/share/keyrings/nginx-keyring.gpg  \
          https://unit.nginx.org/keys/nginx-keyring.gpg
    

    This eliminates the “packages cannot be authenticated” warnings during installation.

  2. To configure Unit’s repository, create the following file named /etc/apt/sources.list.d/unit.list:

    deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ xenial unit
    deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ xenial unit
    
  3. Install the core package and other packages you need:

    # apt update
    
    # apt install unit
    
    # apt install unit-dev unit-jsc8 unit-perl unit-php  \
          unit-python2.7 unit-python3.5 unit-ruby
    
    # systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup
    

Runtime details:

Control socket /var/run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit

macOS§

Unit on macOS comes from the official Homebrew tap freeunitorg/homebrew-unit. The tap is a separate, community maintained repository. It builds the released FreeUnit sources on its own CI, tag 1.37.2 today, and follows the FreeUnit releases.

Tap the repository and install Unit:

$ brew tap freeunitorg/unit https://github.com/freeunitorg/homebrew-unit
$ brew install freeunitorg/unit/unit

This deploys the core unitd binary with njs and the released unitctl command-line tool.

To install the language modules from the tap:

$ brew install freeunitorg/unit/unit-java \
              freeunitorg/unit/unit-perl \
              freeunitorg/unit/unit-php \
              freeunitorg/unit/unit-python3 \
              freeunitorg/unit/unit-ruby \
              freeunitorg/unit/unit-wasm

Note

The old unit-python formula is the Python 2 module. Apple removed Python 2 from macOS, so that formula cannot build on macOS that Homebrew supports. Use unit-python3.

Restart Unit after a module install:

# pkill unitd  # Stop Unit
# unitd        # Start Unit to pick up any changes in language module setup

Runtime details:

Control socket /usr/local/var/run/unit/control.sock (Intel), /opt/homebrew/var/run/unit/control.sock (Apple Silicon)
Log file /usr/local/var/log/unit/unit.log (Intel), /opt/homebrew/var/log/unit/unit.log (Apple Silicon)
Non-privileged user and group nobody

Note

To run Unit as root on macOS:

$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
$ sudo --preserve-env=OBJC_DISABLE_INITIALIZE_FORK_SAFETY /path/to/unitd ...

Node.js§

Unit’s npm-hosted Node.js module is called unit-http. Install it to run Node.js apps on Unit:

  1. First, install the unit-dev/unit-devel package; it’s needed to build unit-http.

  2. Next, build and install unit-http globally (this requires npm and node-gyp):

    # npm install -g --unsafe-perm unit-http
    

    Warning

    The unit-http module is platform dependent due to optimizations; you can’t move it across systems with the rest of node-modules. Global installation avoids such scenarios; just relink the migrated app.

  3. It’s entirely possible to run Node.js apps on Unit without mentioning unit-http in your app sources. However, you can explicitly use unit-http in your code instead of the built-in http, but mind that such frameworks as Express may require extra changes.

Warning

The unit-http module and Unit must have matching version numbers.

If you update Unit later, make sure to update the module as well:

# npm update -g --unsafe-perm unit-http

Note

You can also configure and install the unit-http module from sources.

Working with multiple Node.js versions

To use Unit with multiple Node.js versions side by side, we recommend Node Version Manager:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/x.y.z/install.sh | bash

Install the versions you need and select the one you want to use with Unit:

$ nvm install 18
$ nvm install 16
$ nvm use 18
      Now using node v18.12.1 (npm v8.19.2)

Having selected the specific version, install the node-gyp module:

$ npm install -g node-gyp

Next, clone the FreeUnit source to build a unit-http module for the selected Node.js version:

$ git clone https://github.com/freeunitorg/freeunit
$ cd freeunit
$ pwd
      /home/user/freeunit
$ ./configure
$ ./configure nodejs

      configuring nodejs module
      checking for node ... found
       + node version v18.12.1
      checking for npm ... found
       + npm version 8.19.2
      checking for node-gyp ... found
       + node-gyp version v9.3.0

Point to Unit’s header files and libraries in the source code directory to build the module:

$ CPPFLAGS="-I/home/user/freeunit/include/" LDFLAGS="-L/home/user/freeunit/lib/"  \
      make node-install
$ npm list -g

      /home/vagrant/.nvm/versions/node/v18.12.1/lib
      ├── corepack@0.14.2
      ├── node-gyp@9.3.0
      ├── npm@8.19.2
      └── unit-http@1.29.0

That’s all; use the newly built module to run your Node.js apps on Unit as usual.

Startup and shutdown§

Enable Unit to launch automatically at system startup:

# systemctl enable unit

Start or restart Unit:

# systemctl restart unit

Stop a running Unit:

# systemctl stop unit

Disable Unit’s automatic startup:

# systemctl disable unit

Start Unit as a daemon:

# unitd

Stop all Unit’s processes:

# pkill unitd

For startup options, see below.

Note

Restarting Unit is necessary after installing or uninstalling any language modules to pick up the changes.

Community Repositories§

Warning

These distributions are maintained by their respective communities, not the FreeUnit project. Use them with caution — they still ship the archived unit/ nginx-unit packages and may lag several releases behind.

Note

For package maintainers: the steps to rebase these recipes onto freeunitorg/freeunit (rename the package, swap the source URL, add provides/obsoletes aliases, refresh checksums) are documented in Community Repository Maintainers in the migration guide.

The Alpine Linux packages are named freeunit, not unit. Alpine 3.24 and Alpine edge ship FreeUnit 1.37.2 (checked on 10 November 2026). Alpine 3.23 and 3.22 have no freeunit package. On these releases, build from source. To install FreeUnit’s core executables:

# apk update
# apk upgrade
# apk add freeunit

To install service manager files and specific language modules:

# apk add freeunit-openrc freeunit-perl freeunit-php85 freeunit-python3 freeunit-ruby
# service freeunit restart  # Necessary for Unit to pick up any changes in language module setup

Runtime details:

Control socket /run/control.unit.sock
Log file /var/log/unit.log
Non-privileged user and group unit
Startup and shutdown
# service freeunit enable
# service freeunit restart
# service freeunit stop
# service freeunit disable

To install Unit’s core executables and specific language modules from the Sisyphus packages:

# apt-get update
# apt-get install unit
# apt-get install unit-perl unit-php unit-python3 unit-ruby
# service unit restart  # Necessary for Unit to pick up any changes in language module setup

Versions of these packages with the *-debuginfo suffix contain symbols for debugging.

Runtime details:

Control socket /run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group _unit (mind the _ prefix)
Startup and shutdown
# service unit enable
# service unit restart
# service unit stop
# service unit disable

To install Unit’s core executables and all language modules, clone the Arch User Repository (AUR):

$ git clone https://aur.archlinux.org/nginx-unit.git
$ cd nginx-unit

Before proceeding further, verify that the PKGBUILD and the accompanying files aren’t malicious or untrustworthy. AUR packages are user produced without pre-moderation; use them at your own risk.

Next, build the package:

$ makepkg -si

Runtime details:

Control socket /run/nginx-unit.control.sock
Log file /var/log/nginx-unit.log
Non-privileged user and group nobody
Startup and shutdown
# systemctl enable unit
# systemctl restart unit
# systemctl stop unit
# systemctl disable unit

To install FreeUnit, get the core package and other packages you need:

# pkg install -y freeunit
# pkg install -y freeunit-php85 freeunit-python312
# service unitd restart  # Necessary for Unit to pick up any changes in language module setup

Runtime details:

Rc script /usr/local/etc/rc.d/unitd
Control socket /var/run/unit/control.unit.sock
Log file /var/log/freeunit/freeunit.log
Non-privileged user and group www
Startup and shutdown
# service unitd enable
# service unitd restart
# service unitd stop
# service unitd disable

To install Unit using Portage, update the repository and install the package:

# emerge --sync
# emerge www-servers/nginx-unit

To install specific language modules and features, apply the corresponding USE flags.

Runtime details:

Control socket /run/nginx-unit.sock
Log file /var/log/nginx-unit
Non-privileged user and group nobody
Startup and shutdown
# rc-update add nginx-unit
# rc-service nginx-unit restart
# rc-service nginx-unit stop
# rc-update del nginx-unit

To install Unit’s core package and the other packages you need from the NetBSD Packages Collection:

# pkg_add unit
# pkg_add libunit
# pkg_add unit-perl  \
          unit-python2.7  \
          unit-python3.8 unit-python3.9 unit-python3.10 unit-python3.11 unit-python3.12  \
          unit-ruby31 unit-ruby32 unit-ruby33
# service unit restart  # Necessary for Unit to pick up any changes in language module setup

To build Unit manually, start by updating the package collection:

# cd /usr/pkgsrc && cvs update -dP

Next, browse to the package path to build and install the core Unit binaries:

# cd /usr/pkgsrc/www/unit/
# make build install

Repeat the steps for the other packages you need: libunit (required to install the Node.js module and build Go apps), unit-perl, unit-php, unit-python, or unit-ruby.

Note that unit-php packages require the PHP package to be built with the php-embed option. To enable the option for lang/php82:

# echo "PKG_OPTIONS.php82=php-embed" >> /etc/mk.conf

After that, restart Unit:

# service unit restart  # Necessary for Unit to pick up any changes in language module setup

Runtime details:

Control socket /var/run/unit/control.unit.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit
Startup and shutdown

First, add Unit’s startup script to the /etc/rc.d/ directory:

# cp /usr/pkg/share/examples/rc.d/unit /etc/rc.d/

After that, you can start and stop Unit as follows:

# service unit restart
# service unit stop

To enable or disable Unit’s automatic startup, edit /etc/rc.conf:

# Enable service:
unit=YES

# Disable service:
unit=NO

To install Unit’s core executables and all language modules using the Nix package manager, update the channel, check if Unit’s available, and install the package:

$ nix-channel --update
$ nix-env -qa 'unit'
$ nix-env -i unit

This installs most embedded language modules and such features as SSL or IPv6 support. For a full list of optionals, see the package definition; for a .nix configuration file defining an app, see this sample.

Runtime details:

Control socket /run/unit/control.unit.sock
Log file /var/log/unit/unit.log
Non-privileged user and group unit
Startup and shutdown

Add services.unit.enable = true; to /etc/nixos/configuration.nix and rebuild the system configuration:

# nixos-rebuild switch

After that, use systemctl:

# systemctl enable unit
# systemctl restart unit
# systemctl stop unit
# systemctl disable unit

To install Unit from OpenBSD packages, get the core package and other packages you need:

# pkg_add unit
# pkg_add unit-perl
# pkg_add unit-php74
# pkg_add unit-php80
# pkg_add unit-php81
# pkg_add unit-php82
# pkg_add unit-php83
# pkg_add unit-python
# pkg_add unit-ruby
# rcctl restart unit  # Necessary for Unit to pick up any changes in language module setup

To install Unit from OpenBSD ports, start by updating your port collection, for example:

$ cd /usr/
$ cvs -d anoncvs@anoncvs.spacehopper.org:/cvs checkout -P ports

Next, browse to the port path to build and install Unit:

$ cd /usr/ports/www/unit/
$ make
# make install

This also installs the language modules for Perl, PHP, Python, and Ruby; other modules can be built and installed from source. After that, restart Unit:

# rcctl restart unit  # Necessary for Unit to pick up any changes in language module setup

Runtime details:

Control socket /var/run/unit/control.unit.sock
Log file /var/log/unit/unit.log
Non-privileged user and group _unit
Startup and shutdown
# rcctl enable unit
# rcctl restart unit
# rcctl stop unit
# rcctl disable unit

Remi’s RPM repository, which hosts the latest versions of the PHP stack for Fedora and RHEL, also has the core Unit package and the PHP modules.

To use Remi’s versions of Unit’s packages, configure the repository first. Remi’s PHP language modules are also compatible with the core Unit package from our own repository.

Next, install Unit and the PHP modules you want:

# yum install --enablerepo=remi unit  \
      php54-unit-php php55-unit-php php56-unit-php  \
      php70-unit-php php71-unit-php php72-unit-php php73-unit-php php74-unit-php  \
      php80-unit-php php81-unit-php php82-unit-php
# systemctl restart unit  # Necessary for Unit to pick up any changes in language module setup

Runtime details:

Control socket /run/unit/control.sock
Log file /var/log/unit/unit.log
Non-privileged user and group nobody
Startup and shutdown
# systemctl enable unit
# systemctl restart unit
# systemctl stop unit
# systemctl disable unit

Docker Images§

FreeUnit images are published to GitHub Container Registry as multi-arch manifests (amd64 + arm64).

Tag format: VERSION-VARIANT (pinned) or latest-VARIANT (rolling).

Variant Description
minimal No language modules. Base for custom images.
wasm WebAssembly Components (WASI 0.2) via Wasmtime.
go-1.25 go-1.26 go-1.27 Go (single-version images).
java-17 java-21 java-25 java-26 java-27 Java Servlet Container via Eclipse Temurin OpenJDK. Runs .war/.jsp applications. The java-27 image is based on Ubuntu 26.04.
node-22 node-24 node-26 Node.js (single-version images).
perl-5.38 perl-5.40 perl-5.42 perl-5.44 Perl (single-version images).
php-8.3 php-8.4 php-8.5 PHP (single-version images).
python-3.12 python-3.12-slim Python 3.12, full and slim variants.
python-3.13 python-3.13-slim Python 3.13, full and slim variants.
python-3.14 python-3.14-slim Python 3.14, full and slim variants.
python-3.15 python-3.15-slim Python 3.15, full and slim variants.
ruby-3.3 ruby-3.4 ruby-4.0 Ruby (single-version images).

Note

Older images used variant names without the hyphen, such as php8.4 or jsc21. Their latest- tags still exist. Each release moves an old-style latest- tag, such as latest-php8.4, to the same image as its hyphenated tag, latest-php-8.4, while FreeUnit still builds that variant. Old-style pinned tags, such as 1.35.3-php8.4, exist only for releases up to 1.35.5. A new variant gets no old-style name. Use the hyphenated names.

To pull and run an image:

$ docker pull ghcr.io/freeunitorg/freeunit:TAG
$ docker run -d ghcr.io/freeunitorg/freeunit:TAG
Building custom language-version images

Clone the FreeUnit source, then build a specific variant locally:

$ git clone https://github.com/freeunitorg/freeunit
$ cd freeunit
$ docker build -f pkg/docker/Dockerfile.VARIANT pkg/docker/

See pkg/docker/ for all available Dockerfiles and the Makefile for the full build pipeline. For other customization scenarios, see the Docker howto.

Runtime details:

Control socket /var/run/control.unit.sock
Log file Forwarded to the Docker log collector
Non-privileged user and group unit

For full image details, see the GHCR package page and our Docker howto.

Initial configuration§

The official images support initial container configuration, implemented with an ENTRYPOINT script. First, the script checks the Unit state directory in the container (/var/lib/unit/). If it’s empty, the script processes certain file types in the container’s /docker-entrypoint.d/ directory:

File Type Purpose/Action
.pem Certificate bundles, uploaded under respective names: cert.pem to /certificates/cert.
.json Configuration snippets, uploaded to the /config section of Unit’s configuration.
.sh Shell scripts, run after the .pem and .json files are uploaded; must be executable.

The script warns about any other file types in /docker-entrypoint.d/.

This mechanism enables customizing your containers at startup, reusing configurations, and automating workflows to reduce manual effort. To use the feature, add COPY directives for certificate bundles, configuration fragments, and shell scripts to your Dockerfile derived from an official image:

FROM ghcr.io/freeunitorg/freeunit:1.37.2-minimal
COPY ./*.pem  /docker-entrypoint.d/
COPY ./*.json /docker-entrypoint.d/
COPY ./*.sh   /docker-entrypoint.d/

Note

Mind that running Unit even once populates its state directory; this prevents the script from executing, so this script-based initialization must occur before you run Unit in your derived container.

This feature comes in handy if you want to tie Unit to a certain app configuration for later use. For ad-hoc initialization, you can mount a directory with configuration files to a container at startup:

$ docker run -d --mount  \
         type=bind,src=/path/to/config/files/,dst=/docker-entrypoint.d/  \
         ghcr.io/freeunitorg/freeunit:1.37.2-minimal

Source Code§

FreeUnit’s source code lives in the community-maintained fork at github.com/freeunitorg/freeunit.

$ git clone https://github.com/freeunitorg/freeunit            # Latest updates to the repository
$ # -- or --
$ git clone -b 1.37.2 https://github.com/freeunitorg/freeunit  # Specific version tag; see https://github.com/freeunitorg/freeunit/tags
$ cd freeunit
$ curl -LO https://github.com/freeunitorg/freeunit/archive/refs/tags/1.37.2.tar.gz
$ tar xzf 1.37.2.tar.gz
$ cd freeunit-1.37.2

To build Unit and specific language modules from these sources, refer to the source code howto; to package custom modules, see the module howto.

Alpine Linux§

On Alpine, the PHP embed library is not in the default library path. ./configure php fails with no PHP embed SAPI found. The file libphp.so is in /usr/lib/php85. Pass that directory with --lib-path. This recipe was tested on Alpine 3.24 x86_64 with PHP 8.5:

# apk add build-base openssl-dev pcre2-dev zlib-dev linux-headers php85-dev php85-embed
$ ./configure --openssl
$ ./configure php --module=php85 --config=php-config85 --lib-path=/usr/lib/php85
$ make -j1

On a box with 1 GB of RAM, make -j1 took about 2.5 minutes and used about 400 MiB at peak. A parallel build may run out of memory.