FreeUnit

Installation§

Warning

Official FreeUnit RPM/DEB packages are coming soon. As of April 2026, FreeUnit is distributed via 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:

  • Choose from our official binary packages for a few popular systems (coming soon — see the migration guide for the current status and Docker / Source install paths).
  • If your preferred OS or language version is missing from the official package list, try third-party repositories. Be warned, though: we don’t maintain them. Packagers updating those recipes should follow the maintainer guide.
  • Run our Docker official images, prepackaged with varied language combinations.
  • To fine-tune FreeUnit to your goals, download the sources, install the toolchain, and build a custom binary from scratch; just make sure you know what you’re doing.

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.6 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.0.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

Official FreeUnit RPM/DEB packages are coming soon. The 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. Until FreeUnit’s native packages land, install via Docker or a source build. Progress: https://github.com/freeunitorg/freeunit/milestone/2

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 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§

Warning

The Homebrew tap for FreeUnit is not yet published. Install via Docker or a source build until the tap lands.

Previously, Unit on macOS was installed via the nginx/homebrew-unit tap:

$ brew install nginx/unit/unit  # archived; do not use

This deploys the core Unit binary and the prerequisites for the Node.js language module.

To install the Java, Perl, Python, and Ruby language modules from Homebrew:

$ brew install unit-java unit-perl unit-php unit-python unit-python3 unit-ruby
# 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.

To install Unit’s core executables from the Alpine Linux packages:

# apk update
# apk upgrade
# apk add unit

To install service manager files and specific language modules:

# apk add unit-openrc unit-perl unit-php7 unit-python3 unit-ruby
# service unit 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 unit enable
# service unit restart
# service unit stop
# service unit 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 Unit from FreeBSD packages, get the core package and other packages you need:

# pkg install -y unit
# pkg install -y libunit
# pkg install -y unit-java8  \
                 unit-perl5.36  \
                 unit-php81 unit-php82 unit-php83  \
                 unit-python39  \
                 unit-ruby3.2  \
                 unit-wasm
# service unitd restart  # Necessary for Unit to pick up any changes in language module setup

To install Unit from FreeBSD ports, start by updating your port collection.

With portsnap:

# portsnap fetch update

With git:

# cd /usr/ports && git pull

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

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

Repeat the steps for the other ports you need: libunit (required to install the Node.js module and build Go apps), unit-java, unit-perl, unit-php, unit-python, unit-ruby, or unit-wasm. After that, restart Unit:

# service unitd 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 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.
go1.24 go1.25 go1.26 Go (single-version images).
jsc17 jsc21 Java Servlet Container via Eclipse Temurin OpenJDK LTS. Runs .war/.jsp applications.
node20 node22 node24 Node.js (single-version images).
perl5.38 perl5.40 Perl (single-version images).
php8.3 php8.4 php8.5 PHP (single-version images).
python3.12 python3.12-slim Python 3.12, full and slim variants.
python3.13 python3.13-slim Python 3.13, full and slim variants.
python3.14 python3.14-slim Python 3.14, full and slim variants.
ruby3.3 ruby3.4 Ruby (single-version images).

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.35.4-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.35.4-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.35.4 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.35.4.tar.gz
$ tar xzf 1.35.4.tar.gz
$ cd freeunit-1.35.4

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