Complete LEMP development environment in Docker with Zabbix Agent2 7.4 for monitoring tests and PHP application development.
- 🏗️ Complete LEMP Stack - Ubuntu 24.04, Nginx, PHP 8.3, MySQL 8.0
- 📊 Zabbix Agent2 7.4 - Advanced monitoring from official repository
- 🚀 Quick Start - One command to bring up the entire stack
- 🔧 No Supervisor - Native systemd services for maximum simplicity
- 🌐 Alternative Ports - Compatible with Laravel Herd on macOS
- 📱 Web Dashboard - Testing interface with service status
- 💾 MySQL Persistence - Data preserved between restarts
- 🐛 Integrated Debugging - Built-in logs and diagnostic tools
# Clone/access project directory
cd /path/to/project
# Copy environment configuration (optional)
cp env.example .env
# Build and start the stack
docker-compose up --build
# Or run in background
docker-compose up --build -dWeb Access: http://localhost:8081 (o el puerto configurado en NGINX_HTTP_PORT)
- Docker and Docker Compose
- Available ports: 8081, 8444, 3307, 10050 (configurables via variables de entorno)
- (Optional) Zabbix Server running on localhost:10051
Included Stack:
- Ubuntu 24.04 with native systemd
- Nginx 1.24.0 (port 8081)
- PHP 8.3-FPM with common extensions
- MySQL 8.0 (port 3307)
- Zabbix Agent2 7.4 (port 10050)
Port Mapping (configurable via variables de entorno):
${NGINX_HTTP_PORT:-8081}→ Nginx HTTP (avoids conflict with Herd:80)${NGINX_HTTPS_PORT:-8444}→ Nginx HTTPS (avoids conflict with Herd:443)${MYSQL_PORT:-3307}→ MySQL (avoids conflict with Herd:3306)${ZABBIX_AGENT_PORT:-10050}→ Zabbix Agent
# Start services
docker-compose up -d
# View logs in real time
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild from scratch
docker-compose down && docker-compose up --build
# Access container
docker exec -it lemp-zabbix-test bash# Service status
docker exec lemp-zabbix-test service nginx status
docker exec lemp-zabbix-test service php8.3-fpm status
docker exec lemp-zabbix-test service mysql status
docker exec lemp-zabbix-test service zabbix-agent2 status
# Restart services
docker exec lemp-zabbix-test service nginx restart
docker exec lemp-zabbix-test service mysql restart
docker exec lemp-zabbix-test service zabbix-agent2 restart# View service logs
docker exec lemp-zabbix-test tail -f /var/log/nginx/error.log
docker exec lemp-zabbix-test tail -f /var/log/zabbix/zabbix_agent2.log
# Test Zabbix configuration
docker exec lemp-zabbix-test zabbix_agent2 -t
# Connect to MySQL
docker exec lemp-zabbix-test mysql -u testuser -ptestpass testdb/
├── docker-compose.yml # Main orchestration
├── Dockerfile # LEMP stack image
├── nginx/default.conf # Nginx configuration
├── zabbix/zabbix_agent2.conf # Zabbix configuration
├── scripts/init.sh # Initialization script
├── www/ # Web files
│ ├── index.php # Main dashboard
│ ├── test-mysql.php # Detailed MySQL test
│ └── phpinfo.php # PHP information
├── logs/ # Application logs
└── mysql/data/ # Persistent MySQL data
Copia env.example a .env y modifica los valores según tus necesidades:
cp env.example .env- Root:
${MYSQL_USER:-root}/${MYSQL_ROOT_PASSWORD:-root123} - User:
${MYSQL_USER:-testuser}/${MYSQL_PASSWORD:-testpass} - Database:
${MYSQL_DATABASE:-testdb}
- Server:
${ZABBIX_SERVER:-host.docker.internal}(your Mac) - Port:
${ZABBIX_SERVER_PORT:-10051}(server) /${ZABBIX_AGENT_PORT:-10050}(agent) - Hostname:
lemp-test-host
- Main Dashboard: http://localhost:${NGINX_HTTP_PORT:-8081}
- MySQL Test: http://localhost:${NGINX_HTTP_PORT:-8081}/test-mysql.php
- PHP Info: http://localhost:${NGINX_HTTP_PORT:-8081}/phpinfo.php
# View detailed logs
docker-compose logs
# Check ports in use (reemplaza 8081 con tu puerto configurado)
lsof -i :8081
lsof -i :10050 # Verificar puerto Zabbix Agent# Check status
docker exec lemp-zabbix-test service mysql status
# Reinitialize data (CAUTION: deletes data)
docker-compose down
rm -rf mysql/data/*
docker-compose up --build# Check configuration
docker exec lemp-zabbix-test zabbix_agent2 -t
# View logs
docker exec lemp-zabbix-test tail -f /var/log/zabbix/zabbix_agent2.log# Restart with clean permissions
docker-compose down
docker system prune -f
docker-compose up --buildThis environment is designed for:
- LEMP development testing
- Zabbix configuration testing
- PHP application development
- Application monitoring and metrics
Note: This is a development/testing environment, not for production.
Contributions are welcome! Please:
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you find a bug or have a suggestion:
- Check that a similar issue doesn't exist
- Open a new issue with detailed description
- Include steps to reproduce the problem
- Attach relevant logs if possible
- Architecture: Native Ubuntu systemd services (no supervisor)
- Persistence: MySQL data in
./mysql/data/ - Networking: Host networking for Zabbix server compatibility
- Configuration: Optimized for development and testing
- Compatibility: Designed for macOS with Laravel Herd
- HTTPS support with self-signed certificates
- Optional included Zabbix server configuration
- MySQL backup/restore scripts
- Additional monitoring with Prometheus
- Docker multi-stage builds for optimization
This project is under the GNU General Public License v3.0. See the LICENSE file for details.
Developed with ❤️ for the PHP development and DevOps community.
⭐ If this project was useful to you, give it a star! ⭐