Skip to main content

Certbot NGINX Unit plugin

This is a certbot plugin for using certbot in combination with NGINX Unit https://unit.nginx.org/

Requirement

The command unitc should be installed and executable.

Current Features

  • Supports NGINX Unit/1.31*
  • Supports certbot 3+ (Python 3.10+)
  • install certificates
  • automatic renewal certificates

Installation

  • Via Snap (requires certbot to be installed via snap):

    install snapd

    install certbot

    snap install --classic certbot
    

    install and configure this plugin

    sudo snap install certbot-nginx-unit 
    sudo snap set certbot trust-plugin-with-root=ok
    sudo snap connect certbot:plugin certbot-nginx-unit
    
  • Via Pip

    pip install certbot certbot-nginx-unit
    
  • Via Pip virtual env

    Create a virtual environment, to avoid conflicts

    python3 -m venv /some/path
    

    use the pip in the virtual environment to install or update

    /some/path/bin/pip install -U certbot certbot-nginx-unit
    

    use the cerbot from the virtualenv, to avoid accidentally using one from a different environment that does not have this library

    /some/path/bin/certbot
    

    or uninstall other certbot system installation and link it to /usr/bin

    ln -s /some/path/bin/certbot /usr/bin
    

Usage

Configure the unit listener with *:80 or *:443

# unitc /config
{
    "listeners": {
        "*:80": {
            "pass": "routes"
        }
        "routes": [
            {
                "action": {
                    "share": "/srv/www/unit/index.html"
                }
            }
        ]
    }
}

Now, generate and automatically install the certificate with

# certbot --configurator nginx-unit -d www.myapp.com

The result is a certificate created and installed.

# unitc /certificates
{
	"www.myapp.com_20240202145800": {
		"key": "RSA (2048 bits)",
		"chain": [
			{
				<omissis>
			}
		]
	}
}

and the configuration updated

# unitc /config
{
	"listeners": {
		"*:80": {
			"pass": "routes"
		},

		"*:443": {
			"pass": "routes",
			"tls": {
				"certificate": [
					"www.myapp.com_20240202145800"
				]
			}
		}
	},

	"routes": [
		{
			"match": {
				"uri": "/.well-known/acme-challenge/*"
			},

			"action": {
				"share": "/srv/www/unit/$uri"
			}
		},
		{
			"action": {
				"share": "/srv/www/unit/index.html"
			}
		}
	]
}

Auto-renew certificates

Certbot installs a timer on the system to renew certificates one month before the certificate expiration date.

Multiple domains/applications

You can run the certbot command for each domain

# certbot --configurator nginx-unit -d www.myapp1.com
# certbot --configurator nginx-unit -d www.myapp2.com
# unitc '/config/listeners/*:443' 
{
    "pass": "routes",
    "tls": {
        "certificate": [
            "www.myapp1.com_20240202145800"
            "www.myapp2.com_20240202145800"
        ]
    }
}

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

certbot_nginx_unit-1.1.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

certbot_nginx_unit-1.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file certbot_nginx_unit-1.1.1.tar.gz.

File metadata

  • Download URL: certbot_nginx_unit-1.1.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for certbot_nginx_unit-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2455913149c006a00b6d249658141a97f58564b2588906f26a732526cb504d7f
MD5 8ec55865c807451c77ca7b2e3328ea02
BLAKE2b-256 ed10e58a9602c9edbc8720fabbcba2d4a5f5e4124e49c8d5646c144676ace8b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for certbot_nginx_unit-1.1.1.tar.gz:

Publisher: publish-to-pypi.yml on kea/certbot-nginx-unit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file certbot_nginx_unit-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for certbot_nginx_unit-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc7e80913457b980517d96110c191795019d8c8d663991e64bc7736c49834cb
MD5 c4834fca75a38ae1fc21fbf23335abff
BLAKE2b-256 31d0a3f99e9ce5a861a5fc3c6ca64cd141010352dca73133cf192098199e052a

See more details on using hashes here.

Provenance

The following attestation bundles were made for certbot_nginx_unit-1.1.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on kea/certbot-nginx-unit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.1.2

2 files

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page