A Docker container that combines Nginx and PHP-FPM.
- Nginx + PHP-FPM
- Alpine Linux
- Healthcheck
⚠️ Warning: This container is designed for use with an ingress controller like Traefik. Therefore only port 80 enabled in nginx.
docker build -t nginx-php .
docker run -d -p 80:80 --name nginx-php nginx-php
Create a docker-compose.yml
:
version: '3.8'
services:
nginx-php:
image: ghcr.io/derdaoben/nginx:master
volumes:
- /myWebsite:/var/www/html:ro
ports:
- "80:80"
Then start:
docker-compose up -d
├── Dockerfile
├── config/
│ ├── nginx.conf # Nginx main configuration
│ ├── default.conf # Virtual host configuration
│ └── php.ini-production # PHP configuration
├── entry/
│ └── docker-entrypoint.sh # Container startup script
└── README.md
Variable | Default | Description |
---|---|---|
WEBROOT |
/var/www/html |
Document Root |
Installed extensions:
gd
- Image processinggmp
- Mathematical functionssockets
- Socket communicationgettext
- Internationalizationpdo_mysql
- MySQL PDO Drivermysqli
- MySQL Improved Extensionpdo_pgsql
- PostgreSQL PDO Driver
- Endpoint: http://localhost/123status-traefik
- Interval: Every 30 seconds
- Timeout: 3 seconds
- Logging enabled
# Show container logs
docker logs nginx-php
# With docker-compose
docker-compose logs -f nginx-php
# Copy files to container
docker cp myapp.php nginx-php:/var/www/html/
# Or mount volume
docker run -v /myapp:/var/www/html -p 80:80 nginx-php
# Enter container
docker exec -it nginx-php /bin/sh
# Test Nginx configuration
docker exec nginx-php nginx -t
# PHP-FPM status
docker exec nginx-php php-fpm -t
MIT License - see details in the respective software documentation.