595
A collection of lightweight Lighttpd + PHP-FPM Docker images for hosting web applications and static/dynamic PHP-based files. Each directory represents a single PHP version, plus a lighttpdall variant that bundles most PHP versions into one image.
lighttpdall variant bundles multiple PHP versions at once; the active version is selected via the PHP_VERSION environment variable.packages.sury.org)../www) so no rebuild is needed when content changes.stdout to simplify docker logs.webserver/lighttpd/
├── lighttpd5.6/ # PHP 5.6 image
├── lighttpd7.0/ # PHP 7.0 image
├── lighttpd7.2/ # PHP 7.2 image
├── lighttpd7.4/ # PHP 7.4 image
├── lighttpd8.0/ # PHP 8.0 image
├── lighttpd8.1/ # PHP 8.1 image
├── lighttpd8.2/ # PHP 8.2 image
├── lighttpd8.3/ # PHP 8.3 image
├── lighttpd8.4/ # PHP 8.4 image
└── lighttpdall/ # Multi-PHP-version image
Each version directory shares the same structure:
lighttpd8.3/
├── Dockerfile # Image build definition
├── docker-compose.yml # Run orchestration (port, volume, container name)
├── docker/
│ ├── entrypoint.sh # Startup: enable FastCGI module + start PHP-FPM + Lighttpd
│ ├── fastcgi.conf # FastCGI handler for .php (FPM socket)
│ └── lighttpd.conf # Main Lighttpd configuration
└── www/
└── index.php # Sample page (phpinfo)
| Component | Description |
|---|---|
| Web Server | Lighttpd (lightweight web server) |
| Language | PHP-FPM (FastCGI Process Manager) |
| Protocol | FastCGI (Lighttpd → PHP-FPM via unix socket) |
| Base Image | Debian bookworm |
| Extra PHP Repo | Sury (packages.sury.org) for non-distro PHP versions |
| Directory | PHP | Container Name | Host Port | Built Image |
|---|---|---|---|---|
lighttpd5.6 | 5.6 | lighttpd-php56 | 8081 | lighttpd56-web |
lighttpd7.0 | 7.0 | lighttpd-php70 | 8082 | lighttpd70-web |
lighttpd7.2 | 7.2 | lighttpd-php72 | 8083 | lighttpd72-web |
lighttpd7.4 | 7.4 | lighttpd-php74 | 8084 | lighttpd74-web |
lighttpd8.0 | 8.0 | lighttpd-php80 | 8085 | lighttpd80-web |
lighttpd8.1 | 8.1 | lighttpd-php81 | 8086 | lighttpd81-web |
lighttpd8.2 | 8.2 | lighttpd-php82 | 8087 | lighttpd82-web |
lighttpd8.3 | 8.3 | lighttpd-php83 | 8088 | lighttpd83-web |
lighttpd8.4 | 8.4 | lighttpd-php84 | 8089 | lighttpd84-web |
lighttpdall | 5.6–8.4 | lighttpd-all | 8080 | gleenferdinand/lighttpd-web:all |
Note: The locally built image name follows the compose folder name (e.g.
lighttpd83-web). Thelighttpdallvariant has an explicit image taggleenferdinand/lighttpd-web:all.
Make sure Docker and Docker Compose v2 are installed:
docker --version
docker compose version
Place your web files inside the www/ folder of the relevant directory, or use the bundled sample index.php.
cd webserver/lighttpd/lighttpd8.3
# Build the image
docker compose build
# Start the container
docker compose up -d
# Check status
docker compose ps
Access it in your browser:
http://localhost:8088
If the bundled www/index.php (phpinfo) is still present, the PHP configuration page will be displayed.
Repeat the same steps for the version directory you want. Adjust the port according to the table above:
cd webserver/lighttpd/lighttpd8.4
docker compose build
docker compose up -d
# Access http://localhost:8089
lighttpdall (all PHP versions)This image bundles several PHP-FPM versions at once. The default PHP version is determined by the PHP_VERSION environment variable (default 8.4).
cd webserver/lighttpd/lighttpdall
docker compose build
docker compose up -d
Switching the active PHP version:
# Set PHP_VERSION directly at run time
PHP_VERSION=7.4 docker compose up -d --force-recreate
# Or use .env
docker compose --env-file .env up -d
.env (for lighttpdall)The lighttpdall/.env file is already available and can be edited:
# Choose PHP version (5.6, 7.0, 7.2, 7.4, 8.0, 8.1, 8.2, 8.4)
PHP_VERSION=7.4
# Port for accessing the web (default 8080)
WORDPRESS_PORT=8080
After editing .env, rerun:
docker compose up -d --force-recreate
When the container starts, entrypoint.sh performs several steps:
15-fastcgi-php.conf) to avoid conflicts.10-fastcgi-custom.conf)./run/php directory for PHP-FPM sockets.php-fpm<v> matching the version in that directory.lighttpdall: starts all php-fpm5.6 … php-fpm8.4, then points the .php handler to the $PHP_VERSION socket.lighttpd -D -f /etc/lighttpd/lighttpd.conf.Web request flow:
Browser ──HTTP──▶ Lighttpd ──FastCGI socket──▶ php-fpm<v> ──▶ /var/www/html
docker/lighttpd.confserver.document-root = "/var/www/html" — web folder.server.port = 80 — container internal port.server.username / server.groupname = "www-data" — privilege drop.<include conf-enabled/*.conf> — loads the enabled FastCGI module.accesslog.filename = "/dev/stdout" — access logs to console output.server.errorlog = "/dev/null" — error log disabled.docker/fastcgi.confConnects the .php extension to the corresponding PHP-FPM version socket, for example:
fastcgi.server += (
".php" => (
"localhost" => (
"socket" => "/run/php/php8.3-fpm.sock"
)
)
)
./www:/var/www/html — your web content. Changes on the host are visible in the container immediately.Check container status & logs:
docker ps | grep lighttpd
docker logs <container_name> # e.g. docker logs lighttpd-php83
Test the page response:
curl -i http://localhost:8088
Check the active PHP version (if www/index.php contains phpinfo()):
curl -s http://localhost:8088 | grep -i "PHP Version"
| Symptom | Solution |
|---|---|
| Port already in use | Change the port in docker-compose.yml (the ports section). |
Blank page / .php extension downloaded | Make sure FastCGI is enabled; check docker logs <container>. |
php-fpm<v>: not found | Ensure the PHP version is actually installed in the image (or use the lighttpdall variant). |
| Old PHP version missing from Debian repo | The image uses the Sury repo; make sure the build uses docker compose build --pull. |
| Want to reset / stop | Run docker compose down, then docker compose up -d to start again. |
| Configuration changes not applied | Files in docker/ are only read at build time; after editing them you must run docker compose build again. |
Note: This directory is the x86_64 / amd64 webserver variant. For ARM devices (e.g. Raspberry Pi / Apple Silicon), use the corresponding
..._armvariant directory in the same repository.
Content type
Image
Digest
sha256:126db0409…
Size
114.9 MB
Last updated
about 2 months ago
docker pull gleenferdinand/lighttpd-web