Skip to main content

ℹ️ About Alpine PHP Webserver

A minimal Nginx + PHP-FPM Docker image built on Alpine Linux.

Docker Pulls Docker Image Size License MIT

Attribution

This documentation is a fork of erseco/alpine-php-webserver. The upstream documentation is available here.

What is this image?​

ruseler/alpine-php-webserver packages Nginx, PHP-FPM and a handful of common PHP extensions into a ~25 MB container ready to serve any PHP application. It is designed to be:

  • Small — Alpine base, single-process-group runtime via runit.
  • Secure — Nginx and PHP-FPM run as the unprivileged nobody user.
  • Fast — ondemand FPM process manager; Unix socket between Nginx and PHP; OPcache-ready.
  • Extensible — drop extra daemons into /etc/service/<name>/run, init scripts into /docker-entrypoint-init.d/, Nginx snippets into /etc/nginx/conf.d/ or /etc/nginx/server-conf.d/.
  • Configurable via env vars — every meaningful PHP / Nginx setting is templated at startup via envsubst.

This image is the base for ruseler/alpine-moodle and powers numerous Symfony, Laravel, WordPress and plain PHP deployments.

Features​

  • Lightweight: built on Alpine Linux for a compact final image
  • Nginx + PHP-FPM: runs both via runit, avoiding the overhead of supervisord
  • Non-root by default: Nginx and PHP-FPM run as nobody for improved security
  • Environment-variable driven: tune PHP limits, OPcache, timeouts, and reverse-proxy/trusted-IP settings without touching config files
  • Healthcheck included: built-in HEALTHCHECK hitting the FPM ping endpoint
  • Composer-friendly: designed to be extended with Composer-based builds for your own PHP projects

Where to start​

Minimal example​

docker push ruseler/alpine-php-webserver:tagname
docker run --rm -p 8080:8080 ruseler/alpine-php-webserver

Mount your own code to serve it:

docker run --rm -p 8080:8080 -v "$PWD/php:/var/www/html" ruseler/alpine-php-webserver

This documentation is a fork of erseco/alpine-php-webserver. The upstream documentation is available here.