Sign inSign up

drzippie/php-nginx

By drzippie

•Updated about 18 hours ago

Image
1

791

drzippie/php-nginx repository overview

⁠Docker PHP-FPM 8.4 & Nginx 1.30 on Alpine Linux

Docker Pulls nginx 1.30 php 8.4.27 swoole 6.2.2 imagemagick apcu redis License MIT

Production-ready PHP-FPM 8.4 & Nginx 1.30 container built on Alpine Linux with Node.js 24, Swoole, ImageMagick, APCu, and Redis support for enhanced caching capabilities.

Security update (2026-10-21): latest and 2026-10-21 ship PHP 8.4.27, which fixes the critical unauthenticated RCE vulnerabilities CVE-2026-109618 and CVE-2026-109619. All earlier tags (PHP 8.4.14 on Alpine 3.21) are vulnerable — pull the new image and recreate your containers.

⁠Features

  • Alpine-based: Built on Alpine Linux (~85MB compressed download, ~230MB on disk)
  • Multi-platform: Supports AMD64 and ARM64
  • High Performance: PHP 8.4 with optimized configuration
  • Node.js 24 + npm: For asset building and JS tooling alongside PHP
  • Swoole Support: Includes Swoole 6.2.2 for async/coroutine applications
  • ImageMagick: Full image manipulation capabilities with PHP Imagick extension
  • APCu Caching: In-memory object caching for improved performance
  • Redis Support: Distributed caching, session storage, and data structures
  • SQLite Support: PDO SQLite driver for lightweight/embedded databases
  • Xdebug Ready: Installed but disabled by default — enable via a mounted ini
  • Complete Composer Support: Full functionality with ZIP extension and writable directories
  • Production Ready: Optimized for 100 concurrent users
  • Security First: All processes run as non-privileged user (nobody)
  • Resource Efficient: Uses PHP-FPM's on-demand process manager

⁠Quick Start

# Run with default configuration
docker run -p 80:8080 drzippie/php-nginx

# Mount your application code
docker run -p 80:8080 -v /path/to/your/code:/var/www/html drzippie/php-nginx

# View PHP info
curl http://localhost/

⁠What's Included

⁠Core Components
  • Nginx 1.30: High-performance web server
  • PHP 8.4.27: Latest PHP 8.4 security release
  • PHP-FPM: Process manager with on-demand scaling
  • Supervisord: Process supervisor managing all services
⁠Extensions & Tools
  • Node.js 24 + npm: JavaScript runtime and package manager for asset pipelines
  • Swoole 6.2.2: High-performance async/coroutine framework
  • ImageMagick 7.1.2: Advanced image manipulation (205+ formats)
  • APCu 5.1.28: In-memory object caching with 32MB shared memory
  • Redis 6.3.0: Distributed caching client with connection pooling
  • Xdebug: Installed but disabled by default (enable via a mounted ini)
  • Composer 2.10+: Complete dependency management with ZIP extension and writable directories
  • Common PHP Extensions: bcmath, ctype, curl, dom, exif, fileinfo, gd, iconv, intl, mbstring, mysqli, opcache, openssl, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, phar, session, simplexml, sockets, tidy, tokenizer, xml, xmlreader, xmlwriter, zip

⁠Usage Examples

⁠Basic Web Application
docker run -d \
  --name my-app \
  -p 80:8080 \
  -v /path/to/app:/var/www/html \
  drzippie/php-nginx
⁠With Custom Configuration
docker run -d \
  --name my-app \
  -p 80:8080 \
  -v /path/to/app:/var/www/html \
  -v /path/to/nginx.conf:/etc/nginx/conf.d/default.conf \
  -v /path/to/php.ini:/etc/php84/conf.d/custom.ini \
  drzippie/php-nginx
⁠Swoole Application
# For Swoole HTTP server applications
docker run -d \
  --name swoole-app \
  -p 9501:9501 \
  -v /path/to/swoole-app:/var/www/html \
  drzippie/php-nginx \
  php swoole-server.php
⁠Composer Development
# Install dependencies with persistent cache
docker run -d \
  --name composer-app \
  -p 80:8080 \
  -v /path/to/app:/var/www/html \
  -v composer-cache:/.composer \
  drzippie/php-nginx \
  sh -c "composer install --optimize-autoloader && supervisord -c /etc/supervisor/conf.d/supervisord.conf"
⁠Caching Applications
# APCu caching (in-memory object cache)
docker run -d \
  --name apcu-app \
  -p 80:8080 \
  -v /path/to/app:/var/www/html \
  drzippie/php-nginx

# Redis caching setup
docker network create app-net

# Redis server
docker run -d --name redis --network app-net \
  redis:7-alpine

# Application with Redis
docker run -d --name app --network app-net \
  -p 80:8080 \
  -v /path/to/app:/var/www/html \
  drzippie/php-nginx
⁠WordPress Setup
# Complete WordPress stack with database and Redis
docker network create wordpress-net

# MySQL database
docker run -d --name wp-db --network wordpress-net \
  -e MYSQL_ROOT_PASSWORD=rootpass \
  -e MYSQL_DATABASE=wordpress \
  -e MYSQL_USER=wpuser \
  -e MYSQL_PASSWORD=wppass \
  mysql:8.0

# Redis for object caching
docker run -d --name wp-redis --network wordpress-net \
  redis:7-alpine

# WordPress application
docker run -d --name wordpress --network wordpress-net \
  -p 80:8080 \
  -v wordpress-files:/var/www/html \
  drzippie/php-nginx

⁠Configuration

⁠Environment Variables

The container uses standard PHP and Nginx configurations optimized for production.

⁠Volume Mounts
  • /var/www/html - Application code
  • /etc/nginx/conf.d/ - Nginx server configuration
  • /etc/php84/conf.d/ - PHP configuration files
  • /etc/php84/php-fpm.d/ - PHP-FPM pool configuration
⁠Exposed Ports
  • 8080 - HTTP (Nginx)

⁠Performance & Security

⁠Optimizations
  • On-demand PHP-FPM: Spawns workers only when needed (0-100 workers)
  • Worker Recycling: Prevents memory leaks with request limits
  • Gzip Compression: Optimized for web assets
  • OPcache: Enabled for PHP bytecode caching
  • APCu Cache: 32MB shared memory for object caching
  • Redis Pooling: Connection pooling for distributed caching
  • Resource Limits: Configured for 100 concurrent users
⁠Security Features
  • Non-root execution (nobody user)
  • Hidden server tokens and version headers
  • Secure file access patterns
  • Restricted temporary file locations

⁠Common Use Cases

⁠Web Applications

Perfect for Laravel, Symfony, and especially WordPress with all required extensions and optimized configuration.

⁠Dependency Management

Complete Composer support with ZIP extension, global commands, and persistent cache for efficient package management.

⁠Caching Solutions
  • APCu: In-memory object caching for single-server deployments
  • Redis: Distributed caching for multi-server applications, session storage, and data structures
⁠Image Processing

Built-in ImageMagick support for thumbnails, watermarks, format conversion, and advanced image manipulation.

⁠High-Performance APIs

Swoole support enables building high-performance APIs with async/coroutine capabilities.

⁠Microservices

Lightweight and fast startup makes it ideal for containerized microservices.

⁠Health Check

The container includes a built-in health check endpoint:

curl http://localhost:8080/fmp-ping

⁠Troubleshooting

⁠Common Issues

Container won't start

  • Check if port 8080 is available
  • Verify volume mount paths exist and are readable

PHP errors

  • Check logs with: docker logs container-name
  • Verify PHP configuration with mounted php.ini

Performance issues

  • Monitor with: curl http://localhost:8080/fpm-status
  • Adjust PHP-FPM settings via volume mounts

⁠Documentation

For detailed configuration examples and advanced usage:

⁠Versioning

  • latest - Latest stable release
  • YYYY-MM-DD - Date-based tags for specific versions
TagPHPAlpineNotes
latest, 2026-10-218.4.273.24Fixes CVE-2026-109618 / CVE-2026-109619
2026-07-188.4.143.21Vulnerable — do not use

Check the PHP version of any image with docker run --rm drzippie/php-nginx php -v.

⁠License

MIT License - see LICENSE⁠ file.

⁠About

This image is a fork of TrafeX/docker-php-nginx⁠ with enhanced features for production use including Swoole, ImageMagick, and complete Composer support.


Repository: drzippie/docker-php-nginx⁠
Docker Hub: drzippie/php-nginx⁠

Tag summary

Content type

Image

Digest

sha256:74e86fb71…

Size

80 MB

Last updated

about 18 hours ago

docker pull drzippie/php-nginx