A minimal Nginx + PHP-FPM Docker image built on Alpine Linux — ~25 MB, multi-arch, configured entirely through environment variables.
📚 Full documentation: https://erseco.github.io/alpine-php-webserver/
The documentation site covers quick start, Docker Compose recipes, Nginx/PHP configuration, reverse proxy and trusted-IP setups (Traefik, Nginx, Cloudflare, Cloudflare Tunnel), a complete environment variable reference, Composer/build recipes, how to extend the image with runit daemons and init scripts, the healthcheck and logging story, and a troubleshooting section built from the most frequent support questions.
docker run --rm -p 8080:8080 erseco/alpine-php-webserverOpen http://localhost:8080/ to see phpinfo(), or http://localhost:8080/test.html for the static probe.
Mount your own code:
docker run --rm -p 8080:8080 -v "$PWD/php:/var/www/html" erseco/alpine-php-webserverCompose:
services:
web:
image: erseco/alpine-php-webserver
ports:
- "8080:8080"
volumes:
- ./php:/var/www/html
restart: unless-stoppedlatest,3,3.24,3.24.1(Dockerfile) — PHP 8.53.23,3.23.4(Dockerfile) — PHP 8.43.22,3.22.4(Dockerfile) — PHP 8.43.21,3.21.7(Dockerfile) — PHP 8.43.20,3.20.10(Dockerfile) — PHP 8.3
Note: The
mainbranch (Dockerfile) is automatically pushed with the tagbeta. Use this tag for testing purposes before stable releases are published.
- Compact image (~25 MB) built on Alpine Linux
- PHP 8.5 FPM with
ondemandprocess manager — idles near-zero CPU - Unix-socket FastCGI between Nginx and PHP-FPM
- Healthcheck on
/fpm-ping(localhost-only by design) - Trusted-proxy real IP support (
REAL_IP_FROM, Cloudflare, Tunnel) DISABLE_DEFAULT_LOCATIONfor full routing control- Custom Nginx snippets via
/etc/nginx/conf.d/and/etc/nginx/server-conf.d/ - Custom PHP settings via environment variables or
/etc/php85/conf.d/*.ini - Extra daemons via
runit(/etc/service/<name>/run) - Startup scripts via
/docker-entrypoint-init.d/ - Non-privileged
nobodyuser; logs onstdout/stderr - Multi-arch:
amd64,arm64,arm/v7,arm/v6,386,ppc64le,s390x
The container runs as nobody. When you need root (installing extra Alpine packages for debugging, inspecting file ownership, etc.), use docker compose exec with --user root:
docker compose exec --user root web shExample — install debug tools on a running container:
docker compose exec --user root web sh -c "apk update && apk add nano curl htop"The most-requested reference. The full grouped reference (with OPcache, real IP, reverse proxy recipes) lives at https://erseco.github.io/alpine-php-webserver/environment-variables/.
- Docker Hub:
erseco/alpine-php-webserver - GitHub Container Registry:
ghcr.io/erseco/alpine-php-webserver
The full, searchable documentation lives at https://erseco.github.io/alpine-php-webserver/:
- Quick Start
- Docker Compose examples
- Nginx configuration
- PHP configuration
- Environment variables reference
- Reverse proxy & trusted IPs
- Composer & building your own image
- Extending the image
- Healthcheck & logs
- Troubleshooting
- FAQ
Issues and pull requests are welcome: https://github.com/erseco/alpine-php-webserver/issues.
Documentation sources live under docs/ and are built with Zensical via the docs.yml GitHub Actions workflow.
