Skip to content

v8.0.0 #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 68 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c42457c
Bumping version to 7.0.6
bfren Oct 12, 2023
3ff932d
Updating workflows
bfren Oct 12, 2023
aa36e96
Bumping version to 8.0.0
bfren Nov 9, 2023
983605f
Switching -beta to -dev tags
bfren Nov 9, 2023
0bd2900
Enforcing LF line endings
bfren Nov 9, 2023
856bc02
Refactoring Dockerfile
bfren Nov 9, 2023
9954001
Updating Nginx build
bfren Nov 9, 2023
ad2e42d
Updating copyright year to 2024
bfren Jan 29, 2024
ec62145
Updating copyright year to 2024
bfren Jan 29, 2024
c7eaeaf
Using new http2 config value
bfren Jun 16, 2024
bad3c25
Updating workflows
bfren Jul 30, 2024
7e84bfb
Merge branch 'main' into v8.0.0
bfren Nov 20, 2024
50912df
Removing support for NAXSI
bfren Nov 21, 2024
e4ac8c5
Migrating init to nu
bfren Nov 21, 2024
9875131
Updating SSL conf
bfren Nov 21, 2024
10d3680
Migrating install to nu
bfren Nov 21, 2024
c142af9
Adding initial nu modules and tests
bfren Nov 21, 2024
0a3308b
Adding test.sh
bfren Nov 21, 2024
21c3d8e
Updating to Nginx 1.26.2
bfren Nov 21, 2024
2c780f0
Adding BF prefix to environment variables
bfren Nov 21, 2024
b888bdc
Using latest base image
bfren Nov 22, 2024
ff75b9a
Updating test.sh
bfren Nov 22, 2024
344b143
Adding conf test
bfren Nov 22, 2024
3406e7d
Finishing first conf test
bfren Nov 22, 2024
a8ff487
Finishing conf.json tests
bfren Nov 22, 2024
e6751e9
Removing old dump
bfren Nov 22, 2024
2a5506d
Adding custom tests
bfren Nov 22, 2024
544ba63
Test not outputting custom property
bfren Nov 22, 2024
16c0d14
Moving generate Nginx conf to script and adding tests
bfren Nov 23, 2024
50f50d6
Moving auto scripts and tests into separate module
bfren Nov 24, 2024
4ccbfb4
Adding conf.json loader and tests
bfren Nov 24, 2024
4aae68a
Renaming conf load to get_domains
bfren Nov 24, 2024
811e238
Adding BF_ prefix to documentation
bfren Nov 24, 2024
73bfd38
Adding namespacing to bf write
bfren Nov 24, 2024
459e7ac
Adding generate dhparam and tests
bfren Nov 24, 2024
cef8f01
Moving shared constants to vars module
bfren Nov 24, 2024
ed17494
Adding getssl and tests
bfren Nov 24, 2024
7be542d
Standardising use statement sort order
bfren Nov 24, 2024
c04cbeb
Using shorter environment variables
bfren Nov 24, 2024
f02a318
Using latest base image
bfren Nov 24, 2024
3337843
Adding main init function
bfren Nov 24, 2024
b65625f
Adding tests for nginx config output
bfren Dec 1, 2024
b0ca81b
Adding getssl replace and tests
bfren Dec 1, 2024
fece084
Quoting bf env
bfren Dec 2, 2024
167b2fb
Adding option to quote output for getssl config
bfren Dec 2, 2024
6f2b1e2
Using latest base image
bfren Dec 2, 2024
7b769a0
Supporting parallel test execution
bfren Dec 2, 2024
89ddf4d
Supporting duration in env variables
bfren Dec 2, 2024
6e9b2a3
Improving debug log output
bfren Dec 2, 2024
cbca94d
Splitting out init functions
bfren Dec 2, 2024
20323b5
Adding ssl functions and tests
bfren Dec 2, 2024
a333735
Removing lib files
bfren Dec 4, 2024
797463e
Renaming getssl global config template
bfren Dec 4, 2024
409f99c
Adding missing use
bfren Dec 4, 2024
bae51e8
Safely getting paths
bfren Dec 4, 2024
428606b
Improving docs and output
bfren Dec 4, 2024
f2bb52e
Adding tests for update getssl config file
bfren Dec 4, 2024
82af00d
Adding tests for when domain conf values are not set
bfren Dec 4, 2024
d3a27d0
Adding run.sh
bfren Dec 4, 2024
f8d3c33
Using latest base image
bfren Dec 6, 2024
bed0375
Using latest Nginx build
bfren Dec 9, 2024
cfc6374
Using latest base image
bfren Dec 13, 2024
fa8db32
Moving nginx conf to its own module
bfren Dec 13, 2024
06cb2d0
Adding maintenance module
bfren Dec 13, 2024
51078ee
Switching ssl-auto-request service to Nu
bfren Dec 13, 2024
d5993e7
Updating copyright year to 2025
bfren Jan 31, 2025
a086c7d
Using latest base image
bfren Jan 31, 2025
b4cdb8a
Using latest base image
bfren Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Always use LF endings.
* text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: |
bfren/nginx-proxy:dev
bfren/nginx-proxy:${{ steps.version.outputs.contents }}-beta
bfren/nginx-proxy:${{ steps.version.outputs.contents }}-dev
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
54 changes: 28 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bfren/nginx:nginx1.24-alpine3.18-5.0.16
FROM bfren/nginx:nginx1.26-alpine3.21-6.4.3

LABEL org.opencontainers.image.source="https://github.com/bfren/docker-nginx-proxy"

Expand All @@ -8,42 +8,44 @@ ARG BF_VERSION
# port 80 is already exposed by the base image
EXPOSE 443

COPY ./overlay /

ENV \
# the base domain of the proxy server (will be used when SSL bindings fail)
PROXY_DOMAIN= \
# clean all config and certificates before doing anything else
PROXY_CLEAN_INSTALL=0 \
# the root domain of the proxy server (will be used when SSL bindings fail)
BF_PROXY_DOMAIN= \
# delete all config and certificates before doing anything else
BF_PROXY_CLEAN_INSTALL=0 \
# enable automatic certificate updating
PROXY_ENABLE_AUTO_UPDATE=1 \
# enable NAXSI web application firewall
PROXY_ENABLE_NAXSI=0 \
# use hardened mode (remove old / insecure ciphers and protocols)
PROXY_HARDEN=0 \
BF_PROXY_ENABLE_AUTO_UPDATE=1 \
# use hardened mode (e.g. remove old / insecure ciphers and protocols)
BF_PROXY_HARDEN=0 \
# used for renewal notification emails
PROXY_LETS_ENCRYPT_EMAIL= \
BF_PROXY_GETSSL_EMAIL= \
# set to 1 to use live instead of staging server
PROXY_LETS_ENCRYPT_LIVE=0 \
BF_PROXY_GETSSL_USE_LIVE_SERVER=0 \
# the renew window number of days - certificates with more than this will not renew (Nu duration)
BF_PROXY_GETSSL_RENEW_WINDOW=14day \
# set to 1 to skip local HTTP token check
BF_PROXY_GETSSL_SKIP_HTTP_TOKEN_CHECK=0 \
# set to the number of bits to use for generating private key
PROXY_SSL_KEY_BITS=4096 \
BF_PROXY_SSL_KEY_BITS=4096 \
# set to the number of bits to use for generating DHPARAM
PROXY_SSL_DHPARAM_BITS=4096 \
BF_PROXY_SSL_DHPARAM_BITS=4096 \
# the period of time before self-generated SSL certificates will expire (Nu duration)
BF_PROXY_SSL_EXPIRY=36500day \
# canonical domain name redirection
PROXY_SSL_REDIRECT_TO_CANONICAL=0 \
# set to true to skip local HTTP token check
PROXY_GETSSL_SKIP_HTTP_TOKEN_CHECK="false" \
BF_PROXY_SSL_REDIRECT_TO_CANONICAL=0 \
# if both are set, on first startup will generate SSL config and request certs
PROXY_AUTO_PRIMARY= \
PROXY_AUTO_UPSTREAM= \
BF_PROXY_AUTO_PRIMARY= \
BF_PROXY_AUTO_UPSTREAM= \
# optional - add aliases to the auto-generated conf.json on first startup
PROXY_AUTO_ALIASES= \
BF_PROXY_AUTO_ALIASES= \
# optional - mark the Nginx config as custom so it isn't regenerated on future startups
PROXY_AUTO_CUSTOM=0 \
BF_PROXY_AUTO_CUSTOM=0 \
# upstream DNS resolver, set to Docker's internal resolver by default
PROXY_UPSTREAM_DNS_RESOLVER=127.0.0.11 \
# the number of seconds before the maintenance page will auto-refresh
PROXY_MAINTENANCE_REFRESH_SECONDS=6

COPY ./overlay /
BF_PROXY_UPSTREAM_DNS_RESOLVER=127.0.0.11 \
# the number of seconds before the maintenance page will automatically refresh (Nu duration)
BF_PROXY_MAINTENANCE_REFRESH=6sec

RUN bf-install

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2024 bfren
Copyright (c) 2020-2025 bfren

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[Docker Repository](https://hub.docker.com/r/bfren/nginx-proxy) - [bfren ecosystem](https://github.com/bfren/docker)

Nginx Proxy which uses [getssl](https://github.com/srvrco/getssl) to automate requesting and renewing SSL certificates via Let's Encrypt. Certificates are checked for renewal every day - the last check can be viewed in the `/ssl` volume. Also includes [NAXSI](https://github.com/nbs-system/naxsi), a web application firewall.
Nginx Proxy which uses [getssl](https://github.com/srvrco/getssl) to automate requesting and renewing SSL certificates via Let's Encrypt. Certificates are checked for renewal every day - the last check can be viewed in the `/ssl` volume.

As of v4, configuration is handled via a JSON file - see ssl-conf-sample.json for an example and ssl-conf-schema.json for the full file definition.

Expand Down Expand Up @@ -34,23 +34,22 @@ For SSL certificate requests to work correctly, ports 80 and 443 need mapping fr

## Environment Variables

| Variable | Values | Description | Default |
| ------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `PROXY_AUTO_PRIMARY` | URI | If set (along with PROXY_AUTO_UPSTREAM) SSL config will be generated on first startup. | *None* |
| `PROXY_AUTO_UPSTREAM` | URI | If set (along with PROXY_AUTO_PRIMARY) SSL config will be generated on first startup. | *None* |
| `PROXY_AUTO_ALIASES` | string of URIs | Add aliases to the auto-generated conf.json on first startup. | *None* |
| `PROXY_AUTO_CUSTOM` | 0 or 1 | Mark the auto-generated SSL config to 'custom' so the Nginx configuration is not regenerated on startup. | 0 |
| `PROXY_CLEAN_INSTALL` | 0 or 1 | If 1, all Nginx and SSL configuration and certificates will be deleted and regenerated. | 0 |
| `PROXY_DOMAIN` | URI | The base domain of the proxy server - will be used to handle unbound requests. | *None* - **required** |
| `PROXY_ENABLE_NAXSI` | 0 or 1 | If 1, NAXSI web application firewall will be enabled for all sites. | 0 |
| `PROXY_GETSSL_SKIP_HTTP_TOKEN_CHECK` | true or false | Set to true to enable `getssl`'s [skip HTTP token check](https://github.com/srvrco/getssl/wiki/Config-variables#skip_http_token_checkfalse). | false |
| `PROXY_HARDEN` | 0 or 1 | If 1, only modern SSL ciphers and protocols will be enabled (some older devices may not be able to access it). | 0 |
| `PROXY_LETS_ENCRYPT_EMAIL` | A valid email address | Used by Lets Encrypt for notification emails. | *None* - **required** |
| `PROXY_LETS_ENCRYPT_LIVE` | 0 or 1 | Only set to 1 (to request live certificates) when your config is correct - Lets Encrypt rate limit certificate requests. | 0 |
| `PROXY_MAINTENANCE_REFRESH_SECONDS` | A valid integer | The number of seconds to count down before the maintenance page auto-refreshes. | 6 |
| `PROXY_SSL_DHPARAM_BITS` | A valid integer | The size of your DHPARAM variables - adjust down only if you have limited processing resources. | 4096 |
| `PROXY_SSL_REDIRECT_TO_CANONICAL` | 0 or 1 | If 1, all requests will be redirected to the primary domain (defined in `conf.json`). | 0 |
| `PROXY_UPSTREAM_DNS_RESOLVER` | IP address | Upstream DNS resolver - set to Docker's by default. | 127.0.0.11 |
| Variable | Values | Description | Default |
| ----------------------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `BF_PROXY_AUTO_ALIASES` | string of URIs | Add aliases to the auto-generated conf.json on first startup. | *None* |
| `BF_PROXY_AUTO_CUSTOM` | 0 or 1 | Mark the auto-generated SSL config to 'custom' so the Nginx configuration is not regenerated on startup. | 0 |
| `BF_PROXY_AUTO_PRIMARY` | URI | If set (along with PROXY_AUTO_UPSTREAM) SSL config will be generated on first startup. | *None* |
| `BF_PROXY_AUTO_UPSTREAM` | URI | If set (along with PROXY_AUTO_PRIMARY) SSL config will be generated on first startup. | *None* |
| `BF_PROXY_CLEAN_INSTALL` | 0 or 1 | If 1, all Nginx and SSL configuration and certificates will be deleted and regenerated. | 0 |
| `BF_PROXY_DOMAIN` | URI | The base domain of the proxy server - will be used to handle unbound requests. | *None* - **required** |
| `BF_PROXY_GETSSL_EMAIL` | A valid email address | Used by Lets Encrypt for notification emails. | *None* - **required** |
| `BF_PROXY_GETSSL_SKIP_HTTP_TOKEN_CHECK` | true or false | Set to true to enable `getssl`'s [skip HTTP token check](https://github.com/srvrco/getssl/wiki/Config-variables#skip_http_token_checkfalse). | false |
| `BF_PROXY_GETSSL_USE_LIVE_SERVER` | 0 or 1 | Only set to 1 (to request live certificates) when your config is correct - Lets Encrypt rate limit certificate requests. | 0 |
| `BF_PROXY_HARDEN` | 0 or 1 | If 1, only modern SSL ciphers and protocols will be enabled (some older devices may not be able to access it). | 0 |
| `BF_PROXY_MAINTENANCE_REFRESH_SECONDS` | A valid integer | The number of seconds to count down before the maintenance page auto-refreshes. | 6 |
| `BF_PROXY_SSL_DHPARAM_BITS` | A valid integer | The size of your DHPARAM variables - adjust down only if you have limited processing resources. | 4096 |
| `BF_PROXY_SSL_REDIRECT_TO_CANONICAL` | 0 or 1 | If 1, all requests will be redirected to the primary domain (defined in `conf.json`). | 0 |
| `BF_PROXY_UPSTREAM_DNS_RESOLVER` | IP address | Upstream DNS resolver - set to Docker's by default. | 127.0.0.11 |

## Helper Functions

Expand Down Expand Up @@ -83,4 +82,4 @@ The image contains a handful of useful Nginx configuration 'helper' files, which

## Copyright

> Copyright (c) 2020-2024 [bfren](https://bfren.dev) (unless otherwise stated)
> Copyright (c) 2020-2025 [bfren](https://bfren.dev) (unless otherwise stated)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.1
8.0.0
2 changes: 1 addition & 1 deletion VERSION_MAJOR
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7
8
2 changes: 1 addition & 1 deletion VERSION_MINOR
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1
8.0
3 changes: 0 additions & 3 deletions overlay/etc/bf/ch.d/20-proxy
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
/etc/naxsi www:www 0640 0750
/etc/nginx/sites www:www 0640 0750
/etc/ssl/certs www:www 0640 0750
/sites www:www 0640 0750
/ssl www:www 0640 0750
43 changes: 0 additions & 43 deletions overlay/etc/bf/init.d/20-env

This file was deleted.

35 changes: 35 additions & 0 deletions overlay/etc/bf/init.d/20-env.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use bf
bf env load

# Set environment variables
def main []: nothing -> nothing {
bf env set "PROXY_GETSSL" "/usr/bin/getssl"

let proxy_ssl = "/ssl"
bf env set "PROXY_SSL" $proxy_ssl
bf env set "PROXY_SSL_CONF" $"($proxy_ssl)/conf.json"
bf env set "PROXY_SSL_DHPARAM" $"($proxy_ssl)/dhparam.pem"

let proxy_ssl_certs = $"($proxy_ssl)/certs"
let proxy_getssl_config = "getssl.cfg"
bf env set "PROXY_SSL_CERTS" $proxy_ssl_certs
bf env set "PROXY_GETSSL_CFG" $proxy_getssl_config
bf env set "PROXY_GETSSL_GLOBAL_CFG" $"($proxy_ssl_certs)/($proxy_getssl_config)"
bf env set "PROXY_GETSSL_ACCOUNT_KEY" $"($proxy_ssl_certs)/account.key"

let proxy_sites = "/sites"
bf env set "PROXY_SITES" $proxy_sites

let proxy_acme_challenge = ".well-known/acme-challenge"
bf env set "PROXY_ACME_CHALLENGE" $proxy_acme_challenge
bf env set "PROXY_WWW_ACME_CHALLENGE" $"(bf env NGINX_WWW)/($proxy_acme_challenge)"

let getssl_flags = match (bf env check PROXY_GETSSL_DEBUG) {
true => "-d -U"
false => "-U"
}
bf env set "PROXY_GETSSL_FLAGS" $getssl_flags

# return nothing
return
}
6 changes: 6 additions & 0 deletions overlay/etc/bf/init.d/21-nginx-conf.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use bf
use bf/nginx/proxy nginx
bf env load

# Generate Nginx server SSL configuration file
def main []: nothing -> nothing { nginx generate_server_conf }
19 changes: 0 additions & 19 deletions overlay/etc/bf/init.d/21-ssl-conf

This file was deleted.

49 changes: 0 additions & 49 deletions overlay/etc/bf/init.d/22-ssl-init

This file was deleted.

31 changes: 31 additions & 0 deletions overlay/etc/bf/init.d/22-ssl-init.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use bf
use bf/nginx/proxy
bf env load

# Initialise SSL global config and proxy domain
def main []: nothing -> nothing {
# setup for a clean install
if (bf env check PROXY_CLEAN_INSTALL) {
bf write "Clean install detected."
proxy init setup_clean_install
}

# if auto init is enabled, generate config and ssl
# otherwise, generate SSL for root domain only
if (proxy auto is_enabled) {
# set PROXY_AUTO so we know downstream that we are auto generating files
bf env set "PROXY_AUTO" "1"

# generate conf.json
proxy auto generate_conf_json

# if there are aliases enable canonical redirection
if (bf env check "PROXY_AUTO_ALIASES") { bf env set "PROXY_SSL_REDIRECT_TO_CANONICAL" "1" }

# initialise all domains (root plus auto)
proxy init --all
} else {
# initialise only the root domain
proxy init --root
}
}
11 changes: 11 additions & 0 deletions overlay/etc/bf/init.d/23-maintenance.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use bf
use bf/nginx/proxy maintenance
bf env load

# Generate maintenance helper config and html page
def main []: nothing -> nothing {
bf write "Generating maintenance files."
maintenance generate_helper_conf
maintenance generate_html
return
}
Loading
Loading