Sign inSign up

gleenferdinand/lighttpd-web

By gleenferdinand

•Updated about 2 months ago

Image
Developer tools
Web servers
Content management system
0

595

gleenferdinand/lighttpd-web repository overview

⁠Lighttpd Web Server - Docker Images

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.


⁠Table of Contents


⁠Features

  • Lighttpd web server that is lightweight, fast, and memory-efficient.
  • PHP-FPM runs separately and is connected to Lighttpd through a FastCGI socket.
  • Available for PHP 5.6, 7.0, 7.2, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4.
  • The lighttpdall variant bundles multiple PHP versions at once; the active version is selected via the PHP_VERSION environment variable.
  • Based on Debian bookworm; "EOL" PHP releases (5.6, 7.0, etc.) are provided through the Sury repository (packages.sury.org).
  • The web directory is mounted from the host (./www) so no rebuild is needed when content changes.
  • Access logs are sent to stdout to simplify docker logs.

⁠Directory Structure

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)

⁠Technologies Used

ComponentDescription
Web ServerLighttpd (lightweight web server)
LanguagePHP-FPM (FastCGI Process Manager)
ProtocolFastCGI (Lighttpd → PHP-FPM via unix socket)
Base ImageDebian bookworm
Extra PHP RepoSury (packages.sury.org) for non-distro PHP versions

⁠Image List

DirectoryPHPContainer NameHost PortBuilt Image
lighttpd5.65.6lighttpd-php568081lighttpd56-web
lighttpd7.07.0lighttpd-php708082lighttpd70-web
lighttpd7.27.2lighttpd-php728083lighttpd72-web
lighttpd7.47.4lighttpd-php748084lighttpd74-web
lighttpd8.08.0lighttpd-php808085lighttpd80-web
lighttpd8.18.1lighttpd-php818086lighttpd81-web
lighttpd8.28.2lighttpd-php828087lighttpd82-web
lighttpd8.38.3lighttpd-php838088lighttpd83-web
lighttpd8.48.4lighttpd-php848089lighttpd84-web
lighttpdall5.6–8.4lighttpd-all8080gleenferdinand/lighttpd-web:all

Note: The locally built image name follows the compose folder name (e.g. lighttpd83-web). The lighttpdall variant has an explicit image tag gleenferdinand/lighttpd-web:all.


⁠Usage

⁠1. Prerequisites

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.

⁠2. Running a Specific Version (e.g. PHP 8.3)
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.

⁠3. Running Other Versions

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
⁠4. Running 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
⁠5. Setting Port & PHP via .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

⁠How the Image Works

When the container starts, entrypoint.sh performs several steps:

  1. Removes Lighttpd's default FastCGI configuration (15-fastcgi-php.conf) to avoid conflicts.
  2. Enables the custom FastCGI configuration (10-fastcgi-custom.conf).
  3. Creates the /run/php directory for PHP-FPM sockets.
  4. Starts PHP-FPM:
    • Specific version: 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.
  5. Runs Lighttpd in the foreground: lighttpd -D -f /etc/lighttpd/lighttpd.conf.

Web request flow:

Browser ──HTTP──▶ Lighttpd ──FastCGI socket──▶ php-fpm<v> ──▶ /var/www/html

⁠Configuration

⁠docker/lighttpd.conf
  • server.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.conf

Connects the .php extension to the corresponding PHP-FPM version socket, for example:

fastcgi.server += (
    ".php" => (
        "localhost" => (
            "socket" => "/run/php/php8.3-fpm.sock"
        )
    )
)
⁠Volume
  • ./www:/var/www/html — your web content. Changes on the host are visible in the container immediately.

⁠Verification

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"

⁠Troubleshooting

SymptomSolution
Port already in useChange the port in docker-compose.yml (the ports section).
Blank page / .php extension downloadedMake sure FastCGI is enabled; check docker logs <container>.
php-fpm<v>: not foundEnsure the PHP version is actually installed in the image (or use the lighttpdall variant).
Old PHP version missing from Debian repoThe image uses the Sury repo; make sure the build uses docker compose build --pull.
Want to reset / stopRun docker compose down, then docker compose up -d to start again.
Configuration changes not appliedFiles 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 ..._arm variant directory in the same repository.

Tag summary

Content type

Image

Digest

sha256:126db0409…

Size

114.9 MB

Last updated

about 2 months ago

docker pull gleenferdinand/lighttpd-web