DockerSelf-Hosting

nginx-proxy with Docker: Automatic HTTPS from Container Settings (Linux, Windows, Mac)

Before you start

  • 19 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

nginx-proxy is a free, open-source Nginx reverse proxy in a Docker container that watches your other containers and sends each host name to the right one, based on a single setting (VIRTUAL_HOST); its companion, acme-companion, then gets and renews the Let's Encrypt certificate for that name, so one container setting gives you HTTPS.

nginx-proxy official logo

Logo: the official nginx-proxy project (github.com/nginx-proxy/nginx-proxy, file docs/img/nginx-proxy_light_theme.png, MIT repository licence)

There is no web page and no site list to edit: you add two lines to the app's own Compose file and the route and certificate follow. It is a different tool from the point-and-click Nginx Proxy Manager we covered earlier.

WhatValue (official sources, read 3 December 2026)
Current versionsnginx-proxy 1.11.8 (27 November 2026) and acme-companion v2.8.3 (27 November 2026)
Images to pinnginxproxy/nginx-proxy:1.11.8 and nginxproxy/acme-companion:2.8.3 (tags checked on Docker Hub; no v)
Time and sizeAbout 40 minutes plus DNS waiting (our estimate). About 76 MB and 29 MB compressed for amd64 (Docker Hub API)
PortsTCP 80 and 443 on the proxy only
LicenceMIT for both projects
Official docsnginx-proxy and acme-companion

At a glance:

  • What it is: two containers. nginx-proxy routes; acme-companion gets certificates.
  • Add a site: VIRTUAL_HOST (route) and ACME_HOST (certificate) on the app's container.
  • The price: the Docker socket is mounted in both containers. A separate docker-gen setup reduces that.
  • Not a login page: it secures the connection. Add a password file or single sign-on.

How it fits together#

Both containers read the Docker socket. nginx-proxy turns each VIRTUAL_HOST into an Nginx route. acme-companion asks Let's Encrypt for a certificate for each ACME_HOST, saves it in a shared folder, and nginx-proxy starts using it.

nginx-proxy flow: a visitor sends an HTTPS request to the nginx-proxy container, which routes by host name to your app container; the acme-companion container reads ACME_HOST from your containers, orders a certificate from Let's Encrypt, writes it into the shared folders certs, html and acme, and nginx-proxy loads the certificate from there

Drawn for this guide from the official docs. The dashed line means nginx reads the file; no request is sent.

HTTP-01 is the default way Let's Encrypt checks the name is yours: it visits http://your-name/.well-known/acme-challenge/... on port 80, and the companion puts the answer file in the shared html folder.

Before you start#

Note: every domain, e-mail and password on this page is a dummy (app.example.com, [email protected], the user admin). Replace them with your own, and keep real secrets out of Git.

You need an always-on machine with Docker and Compose and a domain whose DNS you can edit.

SystemWhat to have
LinuxDocker Engine and the Compose plugin
WindowsWindows 10 or later, Docker Desktop (WSL 2 backend), PowerShell
MacDocker Desktop, Intel or Apple Silicon
Run in terminalbash
docker --version
docker compose version

HTTP-01 certificates need (acme-companion README): a DNS A record for app.example.com (and no wrong AAAA record), public TCP ports 80 and 443 forwarded to this machine (never block port 80), and nothing else listening there. Check the ports:

Run in terminalbash
sudo ss -ltnp 'sport = :80 or sport = :443'

Mac: sudo lsof -nP -iTCP:80 -iTCP:443 -sTCP:LISTEN. Windows: Get-NetTCPConnection -State Listen -LocalPort 80,443 -ErrorAction SilentlyContinue. No output means the ports are free.

Checklist:

  • [ ] Both Docker commands print a version
  • [ ] Ports 80 and 443 are free, and you can edit DNS and port forwarding

Tested by DIY Lab Hub: not yet. Commands come from the official docs and source at the release tags, read on 3 December 2026. We did not run them on a real machine.

Tip: A laptop with Docker Desktop (Windows, Mac) rarely has a reachable public port 80. You can still follow Steps 1 to 3 there to learn the routing. No public port 80 at all? Use the DNS-01 challenge (see the FAQ).

Step 1: Create the folders, the network and the settings file#

Everything lives under ~/docker_volumes/nginx-proxy. The certs and acme folders hold private keys and your Let's Encrypt account, so keep them private. The .env file starts with the test Let's Encrypt server (staging), so mistakes do not use up real limits.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/nginx-proxy/{certs,html,acme,vhost.d,htpasswd,backups}
cd ~/docker_volumes/nginx-proxy
cat > .env << 'EOF'
[email protected]
LE_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory
EOF
chmod 600 .env
docker network create proxy

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\nginx-proxy"
foreach ($d in "certs","html","acme","vhost.d","htpasswd","backups") {
  New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location $base
@'
[email protected]
LE_CA_URI=https://acme-staging-v02.api.letsencrypt.org/directory
'@ | Set-Content -Encoding ascii .env
docker network create proxy

Mac (Terminal)#

Same commands as Linux.

Replace the dummy e-mail; Let's Encrypt can warn you about expiring certificates there. The network proxy is the one our Traefik guide also uses; "already exists" is fine.

Check it worked. ls -la (Windows: Get-ChildItem -Force) shows .env and the six folders, and docker network ls lists proxy.

Step 2: Write the Compose file and start the two containers#

Linux#

Run in terminalbash
cd ~/docker_volumes/nginx-proxy
cat > compose.yaml << 'EOF'
services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy:1.11.8
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    labels:
      - "com.github.nginx-proxy.nginx"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./certs:/etc/nginx/certs:ro
      - ./html:/usr/share/nginx/html
      - ./vhost.d:/etc/nginx/vhost.d:ro
      - ./htpasswd:/etc/nginx/htpasswd:ro
    networks:
      - proxy

  acme-companion:
    image: nginxproxy/acme-companion:2.8.3
    container_name: nginx-proxy-acme
    restart: unless-stopped
    depends_on:
      - nginx-proxy
    environment:
      - DEFAULT_EMAIL=${LE_CONTACT_EMAIL}
      - ACME_CA_URI=${LE_CA_URI}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./certs:/etc/nginx/certs:rw
      - ./html:/usr/share/nginx/html:rw
      - ./acme:/etc/acme.sh

networks:
  proxy:
    external: true
EOF
docker compose up -d
docker compose ps

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\nginx-proxy"
@'
services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy:1.11.8
    container_name: nginx-proxy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    labels:
      - "com.github.nginx-proxy.nginx"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./certs:/etc/nginx/certs:ro
      - ./html:/usr/share/nginx/html
      - ./vhost.d:/etc/nginx/vhost.d:ro
      - ./htpasswd:/etc/nginx/htpasswd:ro
    networks:
      - proxy

  acme-companion:
    image: nginxproxy/acme-companion:2.8.3
    container_name: nginx-proxy-acme
    restart: unless-stopped
    depends_on:
      - nginx-proxy
    environment:
      - DEFAULT_EMAIL=${LE_CONTACT_EMAIL}
      - ACME_CA_URI=${LE_CA_URI}
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./certs:/etc/nginx/certs:rw
      - ./html:/usr/share/nginx/html:rw
      - ./acme:/etc/acme.sh

networks:
  proxy:
    external: true
'@ | Set-Content -Encoding ascii compose.yaml
docker compose up -d
docker compose ps

Mac (Terminal)#

Same commands as Linux.

The lines that matter:

LineWhy
Two socket pathsnginx-proxy wants the socket at /tmp/docker.sock, the companion at /var/run/docker.sock (both documented)
certs :ro and :rwOnly the companion writes certificates and private keys
html sharedThe companion writes the challenge files, nginx serves them on port 80
acmeThe Let's Encrypt account and renewal state. Keep it with certs
Label com.github.nginx-proxy.nginxHow the companion finds the proxy. NGINX_PROXY_CONTAINER with the container name does the same
${...}, no version:Compose fills values from .env; the version: key is obsolete

The official files use named Docker volumes. We use folders under ~/docker_volumes and did not test every system. If certificates never appear, or the log says "Permission denied" for the challenge folder, switch the three folders to named volumes (certs:/etc/nginx/certs plus a volumes: block), as the maintainer advised in issue 506.

Check it worked. docker compose ps shows both containers running, and docker compose logs --tail=30 has no line starting Error:. We did not run this; the companion's log starts with Info: running acme-companion version ....

Tip: Docker Desktop handles the socket mount in its own Linux VM. We did not test it there; a socket problem shows in this log at once.

Step 3: Add your first app and test the routing#

A small web app proves the route before any certificate. traefik/whoami prints the request it gets. We make it listen on port 8080, so you see what VIRTUAL_PORT does.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/whoami && cd ~/docker_volumes/whoami
cat > compose.yaml << 'EOF'
services:
  whoami:
    image: traefik/whoami:v1.12.0
    container_name: whoami
    restart: unless-stopped
    expose:
      - "8080"
    environment:
      - WHOAMI_PORT_NUMBER=8080
      - VIRTUAL_HOST=app.example.com
      - VIRTUAL_PORT=8080
    networks:
      - proxy

networks:
  proxy:
    external: true
EOF
docker compose up -d
curl -i -H "Host: app.example.com" http://localhost/

Windows (PowerShell)#

Codepowershell
New-Item -ItemType Directory -Force "$HOME\docker_volumes\whoami" | Out-Null
Set-Location "$HOME\docker_volumes\whoami"
@'
services:
  whoami:
    image: traefik/whoami:v1.12.0
    container_name: whoami
    restart: unless-stopped
    expose:
      - "8080"
    environment:
      - WHOAMI_PORT_NUMBER=8080
      - VIRTUAL_HOST=app.example.com
      - VIRTUAL_PORT=8080
    networks:
      - proxy

networks:
  proxy:
    external: true
'@ | Set-Content -Encoding ascii compose.yaml
docker compose up -d
curl.exe -i -H "Host: app.example.com" http://localhost/

Mac (Terminal)#

Same commands as Linux.

Use your own name instead of app.example.com. The Host: header picks the site, so this works before DNS exists. The app must expose its port and share a network with the proxy (nginx-proxy README). Without VIRTUAL_PORT, nginx-proxy takes the single exposed port, or else port 80.

Check it worked. You get HTTP/1.1 200 OK and the whoami text (Hostname: ..., IP: ..., the shape shown in its README). A 503 means the name does not match.

Tip: VIRTUAL_HOST takes only a name, such as app.example.com, or several separated by commas. A port number in it is not supported. Use VIRTUAL_PORT for the port.

Step 4: Point the name at your server and get a test certificate#

First the outside world: create the DNS A record, forward ports 80 and 443, and check from outside your network (a phone on mobile data) that http://app.example.com shows the whoami text. Then add the certificate request to the app's environment: list:

File contentyaml
    environment:
      - WHOAMI_PORT_NUMBER=8080
      - VIRTUAL_HOST=app.example.com
      - VIRTUAL_PORT=8080
      - ACME_HOST=app.example.com

Every name in ACME_HOST must also be in VIRTUAL_HOST. Recreate the container, then watch the companion.

Linux#

Run in terminalbash
cd ~/docker_volumes/whoami && docker compose up -d
cd ~/docker_volumes/nginx-proxy
docker compose logs -f acme-companion

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\whoami"; docker compose up -d
Set-Location "$HOME\docker_volumes\nginx-proxy"
docker compose logs -f acme-companion

Mac (Terminal)#

Same commands as Linux.

Stop the log with Ctrl+C when it settles. A log in an older issue showed Creating/renewal app.example.com certificates... (app.example.com); yours may differ. Then:

Run in terminalbash
docker exec nginx-proxy-acme cert_status
curl -kI https://app.example.com

On Windows use curl.exe. cert_status is a companion utility that prints your certificates. -k is needed because the test certificate is not trusted.

Check it worked. cert_status lists app.example.com and curl -kI answers 200. curl -I http://app.example.com now redirects to HTTPS (the docs: a name with a usable certificate gets port 80 redirected to 443). Nothing happened? See Troubleshooting.

Tip: Add ACME_HOST only when DNS is ready. A failed check on the real server (Step 5) counts against Let's Encrypt limits.

Step 5: Switch to real certificates#

Change .env to the production server, recreate the companion, and ask it to renew now.

Linux#

Run in terminalbash
cd ~/docker_volumes/nginx-proxy
sed -i 's/acme-staging-v02/acme-v02/' .env
docker compose up -d
docker exec nginx-proxy-acme force_renew

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\nginx-proxy"
(Get-Content .env) -replace 'acme-staging-v02','acme-v02' | Set-Content -Encoding ascii .env
docker compose up -d
docker exec nginx-proxy-acme force_renew

Mac (Terminal)#

Run in terminalbash
cd ~/docker_volumes/nginx-proxy
sed -i '' 's/acme-staging-v02/acme-v02/' .env
docker compose up -d
docker exec nginx-proxy-acme force_renew

force_renew is documented as renewing all certificates in use. We expect it to replace the test one; we did not run it.

Check it worked. curl -I https://app.example.com (no -k) answers 200 with no certificate error, and the browser's padlock is closed. Still an unknown issuer? Run force_renew again and read the log.

Tip: The default certificate authority is Let's Encrypt, not ZeroSSL, even though ZeroSSL maintains these repositories. You need no ZeroSSL account.

Step 6: Tune one site: upload size and a password#

Per-site Nginx settings are plain files in vhost.d. The file name is exactly the host name, with no .conf, and no server { } wrapper inside.

Linux#

Run in terminalbash
cd ~/docker_volumes/nginx-proxy
echo 'client_max_body_size 100m;' > vhost.d/app.example.com
docker run --rm -it -v "$PWD/htpasswd:/work" httpd:2.4.71-alpine htpasswd -cB /work/app.example.com admin
docker compose restart nginx-proxy
docker exec nginx-proxy nginx -t

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\nginx-proxy"
'client_max_body_size 100m;' | Set-Content -Encoding ascii vhost.d\app.example.com
docker run --rm -it -v "$($PWD.Path)\htpasswd:/work" httpd:2.4.71-alpine htpasswd -cB /work/app.example.com admin
docker compose restart nginx-proxy
docker exec nginx-proxy nginx -t

Mac (Terminal)#

Same commands as Linux.

The htpasswd tool asks for the password twice and writes a file named after the host. nginx-proxy turns on basic authentication for every file in that folder. Leave out -c for a second user, because -c creates the file anew. admin is a dummy; the Apache httpd image just supplies the tool on all three systems. The restart matters: the template checks for these files when it writes the config, which happens when containers start or stop (our reading of the template; the docs do not spell it out).

Other settings from the docs: several names with VIRTUAL_HOST=a.example.com,b.example.com; several containers under one name with VIRTUAL_PATH=/api/ and VIRTUAL_DEST=/ (the app must still build links starting with that path); ENABLE_IPV6=true on the proxy (it does not repair a bad IPv6 route).

Check it worked. curl -I https://app.example.com answers 401 Unauthorized; with -u admin:<your-password> it answers 200 (our reading of the docs; not run).

Tip: Adding or removing a file in vhost.d or htpasswd needs a proxy restart. Changing the text of an existing vhost.d file needs only docker exec nginx-proxy nginx -s reload. Run nginx -t first: a typo is easier to read there than in a broken proxy.

Keep the Docker socket away from Nginx (optional)#

In the simple setup the internet-facing Nginx also holds the Docker socket. Docker's security page says anyone who can use the Docker API can start a container with the host's / folder inside it, and then "the container can alter your host filesystem without any restriction". The flag :ro protects only the socket file, not the commands sent through it.

The official alternative runs plain nginx with no socket, docker-gen (it writes the Nginx config) on an internal network, and the companion. nginx-proxy publishes a -dockergen image with the template built in (since 1.11.5). We combined the official pages; we did not run the result.

File contentyaml
services:
  nginx:
    image: nginx:1.31.10-alpine
    container_name: nginx
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    labels:
      - "com.github.nginx-proxy.nginx"
      - "com.github.nginx-proxy.nginx-proxy.nginx"
    volumes:
      - ./conf.d:/etc/nginx/conf.d
      - ./certs:/etc/nginx/certs:ro
      - ./html:/usr/share/nginx/html
      - ./vhost.d:/etc/nginx/vhost.d:ro
      - ./htpasswd:/etc/nginx/htpasswd:ro
    networks:
      - proxy

  docker-gen:
    image: nginxproxy/nginx-proxy:1.11.8-dockergen
    container_name: nginx-proxy-gen
    restart: unless-stopped
    labels:
      - "com.github.nginx-proxy.docker-gen"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./conf.d:/etc/nginx/conf.d
      - ./certs:/etc/nginx/certs:ro
      - ./html:/usr/share/nginx/html:ro
      - ./vhost.d:/etc/nginx/vhost.d:ro
      - ./htpasswd:/etc/nginx/htpasswd:ro
    networks:
      - gen

  # acme-companion: the same block as in Step 2

networks:
  proxy:
    external: true
  gen:
    internal: true

Use this instead of the Step 2 file (same folders, plus conf.d). The nginx container carries two labels: one for the companion, one for docker-gen's reload signal. The folders certs, vhost.d, htpasswd and html must be shared with docker-gen, or it writes a config that Nginx cannot use (official warning). Do not set NETWORK_ACCESS=internal on an app here (issue 2805, open).

This lowers the exposure; it does not remove it, because docker-gen and the companion still hold the socket. The companion's docs describe DOCKER_HOST=tcp://... with TLS client certificates (since 2.8.0); we found no official recipe for a filtered socket proxy with nginx-proxy. Our docker-socket-proxy guide explains the idea; we did not test it with this stack.

Put it behind HTTPS with Traefik instead (or Caddy)#

Pick nginx-proxy if you like Nginx files and VIRTUAL_HOST; pick another proxy if you prefer one container that handles certificates itself. Run only one of them on ports 80 and 443. The table summarises the three designs; it is no speed ranking.

nginx-proxy + acme-companionTraefikCaddy Docker Proxy
How you add a siteVIRTUAL_HOST and ACME_HOST env varsLabels on the containerLabels in Caddyfile syntax
CertificatesSeparate companionBuilt inBuilt in
Own Nginx snippetsYes, files in vhost.dNo (middlewares)No (Caddy directives)
DashboardNoneYesNone
Docker socketIn two or three containersIn the Traefik containerIn the Caddy container
Pick it whenYou know Nginx and want plain files per siteYou want routing rules and a dashboardYou want the shortest config

With Traefik instead#

Set up Traefik with our Traefik guide, then give the app these labels instead of the nginx-proxy variables:

File contentyaml
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.whoami.rule=Host(`app.example.com`)"
      - "traefik.http.routers.whoami.entrypoints=https"
      - "traefik.http.routers.whoami.tls=true"
      - "traefik.http.routers.whoami.tls.certresolver=le"
      - "traefik.http.services.whoami.loadbalancer.server.port=8080"

Without Traefik: Caddy#

Caddy keeps its sites in one Caddyfile and gets Let's Encrypt certificates by itself for a public name. With the apps on the proxy network, conf/Caddyfile is:

File contenttext
app.example.com {
    reverse_proxy whoami:8080
}

Run caddy:2.11.9 with ports 80 and 443 published, ./conf/Caddyfile mounted at /etc/caddy/Caddyfile and a data folder, then check with curl -I https://app.example.com. For a home-only name, tls internal makes Caddy sign its own certificate. Our Caddy guide shows both routes and how to trust the root on Linux, Windows and Mac.

Security and testing#

ControlHow
Docker socketTreat it as root access to the host. :ro is not a limit on the API. Use the separate docker-gen setup if the proxy faces the internet
Trust your containersIssue 2784 (19 October 2026, open when we read it) reports that a crafted VIRTUAL_HOST value can inject Nginx directives, so any container that sets its own environment could reroute traffic. We did not reproduce it. Run no untrusted containers beside the proxy
Private keysThe companion keeps keys at mode 600 by default. Keep certs and acme private and out of Git
PortsPublish only 80 and 443, on the proxy. Apps use expose, never ports

Quick tests, from the proxy folder:

Run in terminalbash
docker compose ps
docker compose logs --tail=50
docker exec nginx-proxy nginx -T
docker exec nginx-proxy-acme cert_status
curl -I https://app.example.com

nginx -T prints the generated config; the upstream block for your host should list your container's address (official troubleshooting page).

Common mistakes#

MistakeWhy it happensDo this instead
503 Service Temporarily Unavailable (issue 1082)The requested name and VIRTUAL_HOST differ (wallabag against wallabag.localhost)Use the identical name, or send -H "Host: app.example.com". The server's IP matches no name
Error: can't get nginx-proxy container ID ! (issue 616)The companion cannot find the proxy containerKeep the label com.github.nginx-proxy.nginx, or set NGINX_PROXY_CONTAINER
stat() ".../acme-challenge/hello-world" failed (13: Permission denied) (issue 506)Nginx cannot read the challenge folder: bind-mount rights, on one NAS a Windows ACL settingFix the permissions, or use a named volume for html
Typo LETENCRYPT_HOST fixed, still 500 (issue 689)A restart keeps the old environmentdocker compose up -d recreates the container. Check with docker exec <app> env
invalid parameter "3000" (issue 2782, open)VIRTUAL_PORT= 3000 has a spaceWrite VIRTUAL_PORT=3000
No certificate files after recreating only certs (issue 1304, open)The acme state was kept and the companion skipped the renewalKeep certs and acme together; back up and restore both
Proxy moved to other host ports (as in issue 1175)Let's Encrypt checks public ports 80 and 443Keep both reachable; a changed host port works only if the router forwards port 80 to it
Pulled latest (issue 1300, open)latest follows the main branch. One report: empty key.pem files after such an updatePin 1.11.8 and 2.8.3 and change them on purpose
AI assistants: ACME_CHALLENGE_TYPE or separate DNS_API variables (issue 1221)Invented names. The log showed the HTTP-01 path: DNS-01 was never onUse ACME_CHALLENGE=DNS-01 and one ACMESH_DNS_API_CONFIG
AI assistants: jwilder/nginx-proxy, jrcs/letsencrypt-nginx-proxy-companion, version: "3", volumes_fromOld tutorials (the 2020 issues above use those names)Use nginxproxy/nginx-proxy and nginxproxy/acme-companion, no version: line
AI assistants: "acme-companion now defaults to ZeroSSL"ZeroSSL maintains the repositoriesThe default ACME_CA_URI is Let's Encrypt. ZeroSSL is opt-in and needs an account

Tip: Since acme-companion 2.8.0 the names are ACME_HOST and ACME_EMAIL. The older LETSENCRYPT_HOST and LETSENCRYPT_EMAIL still work (the template reads ACME_HOST first), but do not mix them.

Tip: Compose applies a changed environment: or label only when it recreates the container. After every edit run docker compose up -d, not restart.

Troubleshooting#

ProblemSolution
503Compare the requested name with VIRTUAL_HOST. docker exec nginx-proxy nginx -T should show an upstream for that name
502The app is still starting (the case in issue 1082), or VIRTUAL_PORT is wrong
The upstream block lists no container addressApp and proxy share no Docker network. Add networks: [proxy] to the app
No certificateSet DEBUG=1 on the companion, docker compose up -d, read docker compose logs acme-companion. Check DNS, ports 80 and 443 from outside, a stray AAAA record, CAA answers
Challenge testdocker exec nginx-proxy-acme bash -c 'echo hi > /usr/share/nginx/html/.well-known/acme-challenge/hello-world', then open that path on your name from outside (official test)
Nginx will not reloaddocker exec nginx-proxy nginx -t names the file and line
Still the test certificatedocker exec nginx-proxy-acme force_renew, then cert_status

Exact error texts#

  • Error: you need to share your Docker host socket with a volume at /var/run/docker.sock: the socket mount is missing or is a folder (companion entrypoint, v2.8.3). It may add might not be readable; on SELinux hosts add :z.
  • Error: can't access to '/etc/nginx/certs' directory !: the folder is not mounted writable on the companion. For html the current version only warns (changed after issue 1159).
  • Error retrieving docker server version info: ... dial unix /tmp/docker.sock: connect: permission denied: the proxy cannot use the socket, seen with rootless Docker (issue 706). Mount that user's own socket.

Known bugs (open, December 2026)#

  • acme-companion 1299: a short restart of an app can remove its certificate links, and the proxy then fails with cannot load certificate.
  • acme-companion 1310: leaked file descriptors stop certificate work (reported on v2.6.3).
  • nginx-proxy 2804: regex paths in VIRTUAL_HOST_MULTIPORTS are ignored since 1.11.0.

We found nothing that stops a plain setup like this one.

Updates and backups#

Update. Read both release pages first. Change both tags in compose.yaml, then:

Run in terminalbash
cd ~/docker_volumes/nginx-proxy
docker compose pull
docker compose up -d
docker compose logs --tail=50

Windows: the same, after Set-Location "$HOME\docker_volumes\nginx-proxy". With named volumes, never use docker compose down -v: it deletes your certificates and account.

What to back up. certs and acme together (see issue 1304), plus vhost.d, htpasswd, .env and compose.yaml. The archive holds private keys: keep it private.

Linux and Mac#

Save as ~/docker_volumes/nginx-proxy/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/nginx-proxy"
out="$base/backups/nginx-proxy-$(date +%F).tar.gz"
tar -czf "$out" -C "$base" certs acme vhost.d htpasswd .env compose.yaml
chmod 600 "$out"

Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):

File contenttext
0 3 * * * /home/<your-user>/docker_volumes/nginx-proxy/backup.sh

Windows (PowerShell)#

Save as $HOME\docker_volumes\nginx-proxy\backup.ps1, then run it daily at 03:00 in Task Scheduler with powershell.exe -NoProfile -File <full-path-to-the-script>:

Codepowershell
$base = "$HOME\docker_volumes\nginx-proxy"
$out = "$base\backups\nginx-proxy-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base certs acme vhost.d htpasswd .env compose.yaml

Restore test#

Unpack the archive in an empty folder on a spare machine, then:

Run in terminalbash
docker network create proxy
docker compose up -d
docker exec nginx-proxy-acme cert_status

The list should show your certificates again, with no new order for them. We did not run a restore.

Performance and resources#

The docs give no minimum RAM or CPU, and we measured none. Run docker stats. The companion checks certificates every hour (CERTS_UPDATE_INTERVAL) and renews after 60 days (ACME_RENEW_AFTER); for Let's Encrypt that is 30 days before expiry.

FAQ#

Can I get a wildcard certificate? Yes, with the DNS-01 challenge only: ACME_CHALLENGE=DNS-01 plus ACMESH_DNS_API_CONFIG for your DNS provider (acme-companion page "Let's Encrypt and ACME"). DNS-01 also works when port 80 cannot be opened. The provider key is a secret: keep it in .env with chmod 600.

Do I need port 80 if I only use HTTPS? For HTTP-01, yes. Let's Encrypt validates on port 80 only, and the README says not to block it or use HTTPS_METHOD=nohttp.

Sources#

Checked against the official docs on 2026-12-03. Nothing was run on a real machine by DIY Lab Hub; the commands come from the docs, the source and the issues above.

Try one of these