Add your web files to /config/www for hosting.
Modify the nginx, php and site config files under /config as needed


Nginx is an HTTP web server, reverse proxy, content cache, load balancer, TCP/UDP proxy server, and mail proxy server.
Pick the optional settings and mods you want, set your paths, ports and values, then copy the result.
---
services:
nginx:
image: ghcr.io/linuxserver-playground/nginx:latest
container_name: nginx
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
volumes:
- /path/to/nginx/config:/config
ports:
- 80:80
- 443:443
restart: unless-stoppedRequired settings only. Tick optional settings and mods to add them.
/path/to folders with real folders on your host; they are created if missing.| Tag | Latest build | Built | Tests |
|---|---|---|---|
:latestStable releasesbranch master · stable | 1.30.8-r0-ls14amd64 · arm64 | passed |
Pulling :latest picks the right one for your host automatically.
amd64-latestarm64v8-latestghcr.io/linuxserver-playground/nginx:1.30.8-r0-ls14
Live branches, their latest release, upstream version and next scheduled check.
live branchesloading…
| Branch → tag | Last build | Released | Upstream | Drift | Next check | Flags |
|---|---|---|---|---|---|---|
| master → :latest | success | 1.30.8-r0 | ? unknown | – | – |
Add your web files to /config/www for hosting.
Modify the nginx, php and site config files under /config as needed
| Port | Function | Required |
|---|---|---|
| 80:80 | http | required |
| 443:443 | https | required |
| Variable | Function | Required |
|---|---|---|
| PUID=1000 | User ID | required |
| PGID=1000 | Group ID | required |
| TZ=Etc/UTC | Timezone | required |
| NGINX_AUTORELOAD= | Set to true to enable automatic reloading of confs on change without stopping/restarting nginx. Your filesystem must support inotify. This functionality was previously offered via mod (opens in a new tab). | optional |
| NGINX_AUTORELOAD_WATCHLIST= | A pipe (opens in a new tab)-separated list of additional folders for auto reload to watch in addition to /config/nginx | optional |
| Path | Function | Required |
|---|---|---|
| /config | Persistent config files | required |
This image can be run with a read-only container filesystem. For details please read the docs.
/tmp must be mounted to tmpfsYou can set any environment variable from a file by using a special prepend FILE__.
As an example:
-e FILE__MYVAR=/run/secrets/mysecretvariable
Will set the environment variable MYVAR based on the contents of the /run/secrets/mysecretvariable file.
For all of our images we provide the ability to override the default umask settings for services started within the containers using the optional -e UMASK=022 setting.
Keep in mind umask is not chmod it subtracts from permissions based on it’s value it does not add. Please read up here before asking for support.
When using volumes (-v flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
In this instance PUID=1000 and PGID=1000, to find yours use id your_user as below:
id your_user
Example output:
uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)
Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the Application Setup section above to see if it is recommended for the image.
Below are the instructions for updating containers:
Update images:
All images:
docker-compose pull
Single image:
docker-compose pull nginx
Update containers:
All containers:
docker-compose up -d
Single container:
docker-compose up -d nginx
You can also remove the old dangling images:
docker image prune
Update the image:
docker pull ghcr.io/linuxserver-playground/nginx:latest
Stop the running container:
docker stop nginx
Delete the container:
docker rm nginx
Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your /config folder and settings will be preserved)
You can also remove the old dangling images:
docker image prune
We recommend Diun for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
If you want to make local modifications to these images for development purposes or just to customize the logic:
git clone https://github.com/linuxserver-playground/docker-nginx.git
cd docker-nginx
docker build \
--no-cache \
--pull \
-t ghcr.io/linuxserver-playground/nginx:latest .
The ARM variants can be built on x86_64 hardware and vice versa using ghcr.io/linuxserver/qemu-static
docker run --rm --privileged ghcr.io/linuxserver/qemu-static --reset
Once registered you can define the dockerfile to use with -f Dockerfile.aarch64.
Every push builds and tests the image with the shared workflow in linuxserver-playground/workflows; every build’s tests, screenshots and package changes are on the image’s builds on the website.
The newest five builds per branch, each with its CI report; 9 older releases are on GitHub, listed below.
| Tag | Built | Reason | Change | Result | Size |
|---|---|---|---|---|---|
| 1.30.8-r0-ls14master · 9ae4e82f | weekly package check | base | success | 54.0 MB amd6454.6 MB arm64 | |
| 1.30.8-r0-ls13master · d5eb2d93 | upstream check | mixed | success | 54.0 MB amd6454.6 MB arm64 | |
| 1.30.7-r0-ls12master · fb5ba99c | weekly package check | base | success | 54.1 MB amd6454.6 MB arm64 | |
| 1.30.7-r0-ls11master · f107b685 | weekly package check | base | success | 56.5 MB amd6457.4 MB arm64 | |
| 1.30.7-r0-ls10master · 6a99000f | upstream check | mixed | success | 54.1 MB amd6454.6 MB arm64 |
Add a mod with DOCKER_MODS=<image>; separate several with |.
This mod adds some of the proxy-conf functionality that is baked into SWAG, to Nginx.
Make sure that the line below, under virtual hosts, is in your nginx.conf, otherwise crowdsec-bouncer will not work. More information here https://info.linuxserver.io/issues/2022-08-20-nginx-base/
This mod adds imagemagick and the php imagick module to nginx/swag, to be installed/updated during container start.
This mod adds Ioncube loader to SWAG/nginx, to be installed/updated during container start.
Plus 13 other universal mods that work with every image.
nginx listens on http://nginx:80.
## Version 2026/11/28
# make sure that your nginx container is named nginx
# make sure that your dns has a cname set for nginx
server {
listen 443 ssl;
# listen 443 quic;
listen [::]:443 ssl;
# listen [::]:443 quic;
server_name nginx.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth (requires ldap-location.conf in the location block)
#include /config/nginx/ldap-server.conf;
# enable for Authelia (requires authelia-location.conf in the location block)
#include /config/nginx/authelia-server.conf;
# enable for Authentik (requires authentik-location.conf in the location block)
#include /config/nginx/authentik-server.conf;
# enable for Tinyauth (requires tinyauth-location.conf in the location block)
#include /config/nginx/tinyauth-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable for ldap auth (requires ldap-server.conf in the server block)
#include /config/nginx/ldap-location.conf;
# enable for Authelia (requires authelia-server.conf in the server block)
#include /config/nginx/authelia-location.conf;
# enable for Authentik (requires authentik-server.conf in the server block)
#include /config/nginx/authentik-location.conf;
# enable for Tinyauth (requires tinyauth-server.conf in the server block)
#include /config/nginx/tinyauth-location.conf;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app nginx;
set $upstream_port 80;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}Default sample.
Source: linuxserver-playground.github.io/hub/api/v1/catalog/nginx/proxy.json
Rebase to Alpine 3.24 with PHP 8.5.
Fixed auto-reload functionality.
Rebase to Alpine 3.22 with PHP 8.4. Add Auto Reload (opens in a new tab) functionality. Drop PHP bindings for mcrypt as it is no longer maintained.
Rebase to Alpine 3.21.
Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings.
Rebase to Alpine 3.19 with php 8.3.
Rebase to Alpine 3.18, deprecate armhf.
Remove nchan module because it keeps causing crashes.
Questions about running nginx? Start with the documentation and the community; open an issue for bugs.
Shell access whilst the container is running:
docker exec -it nginx /bin/bash
To monitor the logs of the container in realtime:
docker logs -f nginx
Container version number:
docker inspect -f '{{ index .Config.Labels "build_version" }}' nginx
Image version number:
docker inspect -f '{{ index .Config.Labels "build_version" }}' ghcr.io/linuxserver-playground/nginx:latest
Community project
This image is kept up by volunteers, and you can be one of them. You don't need to know how the pipeline works: point an AI agent at the harness and describe what you want. It reproduces the problem in your Docker, tests the change and drafts the pull request for you to check.
Ask your agent
Contributing an image Every way to help Get the harness (opens in a new tab)
Writing


2 min read
SWAG Dashboard is a mod powered by GoAccess that provides a comprehensive overview of SWAG's operation. Follow latest the instructions on the mod's readme to set it up. Navigate…

7 min read
SWAG - Secure Web Application Gateway (formerly known as letsencrypt) is a full fledged web server and reverse proxy with Nginx, Php7, Certbot (Let's Encrypt™ client) and Fail2ban…
Related
5.10.0-ls16
SWAG - Secure Web Application Gateway (formerly known as letsencrypt, no relation to Let's Encrypt™) sets up an Nginx webserver and reverse proxy with php support and a built-in certbot client that automates free SSL server certificate generation and renewal processes (Let's Encrypt and ZeroSSL). It also contains fail2ban for intrusion prevention.