A efficient web server sensible Apache defaults, and performance optimizations.
1.2K
PHP Docker Image (Optimized Trixie Builds)
This Docker image provides a efficient web server based on PHP 8.4 / 8.5 with Apache, designed to serve modern PHP applications in a production-ready Docker environment. It comes pre-configured with commonly used PHP extensions, sensible Apache defaults, and performance optimizations out of the box.
✅ Features
Base Image
Built on the official PHP 8.4 / 8.5 (Debian Trixie) image with Apache support, ensuring stability, security, and compatibility with modern PHP applications.
Apache Configuration
Hardened Apache defaults:
🚀 Getting Started
Run the PHP 8.4 container
docker run -d --name webserver -p 80:80 chrno79/php-apache:latest
Run the PHP 8.5 container
docker run -d --name webserver -p 80:80 chrno79/php-apache:dev
Apache will be available on port 80.
📁 Volume Mapping
To serve your PHP application:
docker run -d --name webserver -p 80:80 \
-v /path/to/your/php/files:/var/www/html \
chrno79/php-apache:latest
Replace /path/to/your/php/files with the path to your PHP project.
🔧 Using RemoteIP (Reverse Proxy Support)
To forward the real client IP from a reverse proxy, create a remoteip.conf:
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 172.18.0.0/16
RemoteIPTrustedProxy 172.19.0.0/24
Mount it into the container:
docker run -d --name webserver -p 80:80 \
-v /path/to/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro \
-v /path/to/your/php/files:/var/www/html \
chrno79/php-apache:latest
The configuration is automatically enabled at startup.
Nginx Proxy Manager example
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
🔧 Mount with custom php.ini
You can provide your own PHP configuration:
docker run -d --name webserver -p 80:80 \
-v /path/to/remoteip.conf:/etc/apache2/conf-enabled/remoteip.conf:ro \
-v /path/to/your/php/files:/var/www/html \
-v /path/to/your/custom_php.ini:/usr/local/etc/php/php.ini
chrno79/php-apache:latest
🤝 Contributing
Contributions are welcome! Fork the repository and submit pull requests for improvements, new features, or updated extensions.
Content type
Image
Digest
sha256:daf45d746…
Size
396.4 MB
Last updated
7 months ago
docker pull chrno79/php-apache