A starter local stack for PHP apps that need Nginx and MySQL. Review paths, ports and secrets before production.
docker-compose.yml
services:
app:
image: php:8.3-fpm
volumes:
- ./app:/var/www/html
nginx:
image: nginx:alpine
ports:
- "8080:80"
volumes:
- ./app:/var/www/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- app
mysql:
image: mysql:8
environment:
MYSQL_DATABASE: app
MYSQL_USER: app
MYSQL_PASSWORD: app_local_password
MYSQL_ROOT_PASSWORD: root_local_password
volumes:
- mysql_data:/var/lib/mysql
volumes:
mysql_data:
How to use this example
- Create app and nginx.conf paths before starting the stack.
- Run docker compose up -d.
- Check docker compose logs -f if any service exits.
Notes
- Starter passwords are for local development only.
- Use named volumes for database persistence.
Related tools and fixes
Last updated: May 18, 2026