Secure Web Application Gateway: Nginx with Certbot and fail2ban in one container
open sourceGPL-3.0-onlyself-hostablefree
SWAG (Secure Web Application Gateway, formerly LinuxServer.io's letsencrypt image) is a Docker image from LinuxServer.io that bundles an Nginx web server and reverse proxy with PHP, a Certbot client that gets and renews free certificates from Let's Encrypt or ZeroSSL (HTTP or DNS validation, including wildcards), and fail2ban for intrusion prevention. It ships preset reverse proxy configs for hundreds of popular self-hosted apps as sample files you rename to enable, and configs for HTTP basic auth, LDAP and Authelia. Docker mods add a GoAccess dashboard, CrowdSec, MaxMind geoblocking and automatic proxy configs for containers labelled swag=enable. You configure it by editing Nginx files, not through a web UI. GPL-3.0.
Ways to install
On your own server
Problems it solves
- put all my self-hosted apps behind one Nginx reverse proxy with free HTTPS in a single container
- get a wildcard certificate for my home server's domain through Cloudflare DNS and renew it automatically
- ban IPs that keep failing logins on my reverse proxy
- set up a reverse proxy for Jellyfin, Nextcloud or the arr apps without writing the Nginx config from scratch
- my ISP blocks port 80, so I need certificates through DNS validation for my homelab
- protect self-hosted apps with Authelia or LDAP login at the proxy
- share Let's Encrypt certificates from my proxy with other containers like Emby or ZNC
- automatically proxy new Docker containers just by adding a label
- block traffic from other countries to my home server using GeoIP
- add CrowdSec protection to my Nginx reverse proxy in Docker
- host a small PHP site or WordPress next to my reverse proxy
- see a dashboard of who is hitting my reverse proxy
- serve my self-hosted apps over HTTP/3 (QUIC)
Features
- Nginx web server and reverse proxy with PHP
- built-in Certbot: free certificates from Let's Encrypt or ZeroSSL, renewed automatically using ACME Renewal Information
- HTTP and DNS validation, with many Certbot DNS plugins and wildcard certificates
- fail2ban with five Nginx jails enabled by default
- preset reverse proxy configs for popular apps, subdomain and subfolder styles
- HTTP basic auth (htpasswd), LDAP auth and Authelia configs
- certificates exported as PEM, PFX and a private-fullchain bundle for other containers
- QUIC/HTTP3 support (opt-in per proxy config)
- Docker mods: GoAccess dashboard, CrowdSec bouncer, MaxMind geoblocking, Cloudflare real IP and auto-proxy from container labels
- automatic Nginx reload when watched config files change (SWAG_AUTORELOAD)
View 2 more
- read-only container filesystem support
- x86-64 and arm64 images
Limitations
- Doesn't run on 32-bit ARM (armhf): images are built for x86-64 and arm64 only2
Capabilities
| Takes plugins | plan not known |
|---|
Alternatives
The same job
These do what SWAG does.
- Nginx Proxy Manager Expose your services easily and securely
- Zoraxy A general purpose HTTP reverse proxy and forwarding tool
- Caddy The Ultimate Server with Automatic HTTPS
- Nginx UI Yet another WebUI for Nginx
- Traefik Proxy The Cloud Native Application Proxy
- HAProxy The Reliable, High Performance TCP/HTTP Load Balancer