Professional Multi-Environment Web Stack Management System
WebStack Manager is a powerful, production-ready tool for managing multiple isolated web environments on a single server. Perfect for agencies, developers, and hosting providers who need to run multiple websites with different technology stacks.
- Multi-OS Support: Works on Debian, Ubuntu, AlmaLinux, Rocky Linux, and RHEL
- Complete Isolation: Each site runs in its own Docker containers
- Version Flexibility: Mix and match PHP versions (7.4, 8.0, 8.1, 8.2, 8.3)
- Database Options: MySQL (5.7, 8.0), MariaDB (10.11, 11.2), PostgreSQL (16)
- Automatic SSL: Let's Encrypt certificates via Traefik reverse proxy
- Interactive Setup: Guided prompts for all configuration
- Easy Management: Simple CLI for all operations
- Built-in Backups: One-command site backups
- Resource Monitoring: Track CPU, memory, and disk usage
┌─────────────────────────────────────────────┐
│ Traefik Reverse Proxy │
│ (Automatic SSL + Load Balancing) │
└─────────────────┬───────────────────────────┘
│
┌─────────┴─────────┐
│ │
┌───────▼──────┐ ┌──────▼───────┐
│ Site 1 │ │ Site 2 │
│ PHP 8.3 │ │ PHP 7.4 │
│ MariaDB 11 │ │ MySQL 5.7 │
│ + Redis │ │ │
└──────────────┘ └──────────────┘
- OS: Debian 11+, Ubuntu 20.04+, AlmaLinux 8+, Rocky Linux 8+
- RAM: Minimum 2GB (4GB+ recommended)
- Disk: 20GB+ free space
- Ports: 80, 443 available
- Access: Root or sudo privileges
# Download the installer
wget https://raw.githubusercontent.com/joogiebear/web-stack/main/webstack-install.sh
# Make it executable
chmod +x webstack-install.sh
# Run the installer as root
sudo ./webstack-install.shThe installer will:
- Detect your operating system
- Install Docker and Docker Compose
- Set up Traefik reverse proxy
- Prompt for your SSL email address
- Install the
webstackCLI tool
webstack createYou'll be prompted for:
- Site name (e.g.,
mysite) - Domain name (e.g.,
example.com) - PHP version (7.4, 8.0, 8.1, 8.2, 8.3)
- Database type (MySQL, MariaDB, PostgreSQL)
- Database credentials
- Additional services (Redis, Adminer)
Update your domain's DNS to point to your server's IP:
A example.com → YOUR.SERVER.IP
A www.example.com → YOUR.SERVER.IP
Visit https://example.com - SSL certificate will be automatically generated on first visit!
# Create a new site (interactive)
webstack create
# List all sites
webstack list
# Start a site
webstack start mysite
# Stop a site
webstack stop mysite
# Restart a site
webstack restart mysite
# Delete a site (with confirmation)
webstack delete mysite# View site information
webstack info mysite
# View logs (real-time)
webstack logs mysite # Web server logs
webstack logs mysite php # PHP-FPM logs
webstack logs mysite db # Database logs
# System status
webstack status
# Create backup
webstack backup mysitewebstack create
Site name: myblog
Domain: myblog.com
PHP version: 8.1
Database: MariaDB 10.11
Add Redis: y
Add phpMyAdmin: yThen upload WordPress files to /opt/webstack/sites/myblog/public/
webstack create
Site name: myapp
Domain: myapp.com
PHP version: 8.3
Database: MySQL 8.0
Add Redis: y
Add phpMyAdmin: nUpload your Laravel app and update .env with provided database credentials.
webstack create
Site name: legacy
Domain: old-app.com
PHP version: 7.4
Database: MySQL 5.7
Add Redis: n
Add phpMyAdmin: y/opt/webstack/
├── sites/
│ ├── site1/
│ │ ├── public/ # Web root (upload files here)
│ │ ├── logs/ # Site-specific logs
│ │ ├── docker-compose.yml # Container configuration
│ │ ├── nginx.conf # Web server config
│ │ ├── .env # Site credentials
│ │ └── README.md # Site info
│ └── site2/
│ └── ...
├── traefik/
│ ├── traefik.yml # Traefik configuration
│ ├── acme/ # SSL certificates
│ └── docker-compose.yml
├── backups/ # Site backups
├── templates/ # Docker templates
└── logs/ # System logs
Edit the site's Nginx config:
nano /opt/webstack/sites/mysite/nginx.conf
webstack restart mysiteEach site includes database credentials in /opt/webstack/sites/mysite/.env:
cat /opt/webstack/sites/mysite/.envConnect directly to the database:
docker exec -it mysite_db mysql -u mysite_user -pCreate a custom Dockerfile in the site directory:
FROM php:8.3-fpm-alpine
RUN docker-php-ext-install mysqli pdo pdo_mysql gdUpdate docker-compose.yml to use the custom image.
Add resource limits to docker-compose.yml:
services:
php:
deploy:
resources:
limits:
cpus: '1.0'
memory: 512MAdd to crontab:
# Backup all sites daily at 2 AM
0 2 * * * webstack backup mysitewebstack statusShows:
- Traefik status
- Sites count (total, running, stopped)
- Docker resource usage
- Disk usage
# Web server access logs
webstack logs mysite web
# PHP error logs
webstack logs mysite php
# Database logs
webstack logs mysite db
# All services
cd /opt/webstack/sites/mysite && docker compose logs -f# View certificate expiry
docker exec traefik cat /acme/acme.json | jq-
Check if containers are running:
webstack list
-
Check Traefik logs:
docker logs traefik
-
Verify DNS is pointing to server:
nslookup yourdomain.com
-
Check site logs:
webstack logs mysite
-
Ensure ports 80 and 443 are open:
netstat -tlnp | grep -E ':(80|443)'
-
Verify email in Traefik config:
cat /opt/webstack/traefik/traefik.yml
-
Check Traefik logs for ACME errors:
docker logs traefik | grep -i acme
-
Verify credentials:
cat /opt/webstack/sites/mysite/.env
-
Check database container:
docker ps | grep mysite_db docker logs mysite_db -
Test connection:
docker exec -it mysite_db mysql -u mysite_user -p
-
Check Docker disk usage:
docker system df
-
Clean up unused images and volumes:
docker system prune -a --volumes
-
Remove old backups:
ls -lh /opt/webstack/backups/ rm /opt/webstack/backups/old_backup.tar.gz
-
Firewall Configuration
# Allow only HTTP, HTTPS, and SSH ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp ufw enable
-
Regular Updates
# Update system packages apt update && apt upgrade -y # Debian/Ubuntu dnf update -y # AlmaLinux # Update Docker images docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
-
Strong Passwords
- Use auto-generated passwords (default)
- Store credentials securely
- Never commit
.envfiles to version control
-
Regular Backups
# Set up automated backups 0 2 * * * /usr/local/bin/webstack backup site1 0 3 * * * /usr/local/bin/webstack backup site2
-
Monitor Logs
# Check for suspicious activity webstack logs mysite | grep -i "error\|warning\|fail"
Create php.ini in site directory:
[opcache]
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2Mount it in docker-compose.yml:
php:
volumes:
- ./php.ini:/usr/local/etc/php/conf.d/custom.iniWhen creating a site, answer 'y' to add Redis. Configure your application:
// WordPress wp-config.php
define('WP_REDIS_HOST', 'redis');
define('WP_REDIS_PORT', 6379);
// Laravel .env
REDIS_HOST=redis
REDIS_PORT=6379Edit site's Nginx config:
client_max_body_size 100M;Add to PHP environment in docker-compose.yml:
php:
environment:
- PHP_MEMORY_LIMIT=256M
- PHP_UPLOAD_MAX_FILESIZE=100M
- PHP_POST_MAX_SIZE=100M-
Create backup on old server:
tar -czf site-backup.tar.gz /var/www/html /path/to/database-dump.sql
-
Transfer to new server:
scp site-backup.tar.gz user@newserver:/tmp/
-
Create site on new server:
webstack create # Use same configuration -
Extract files:
tar -xzf /tmp/site-backup.tar.gz -C /opt/webstack/sites/mysite/public/
-
Import database:
docker exec -i mysite_db mysql -u user -p database < dump.sql
# Create full backup
webstack backup mysite
# Backup file location
ls -lh /opt/webstack/backups/mysite_*.tar.gzTo completely remove WebStack Manager:
# Stop all sites
for site in /opt/webstack/sites/*; do
cd "$site" && docker compose down -v
done
# Stop Traefik
cd /opt/webstack/traefik && docker compose down
# Remove Docker network
docker network rm webstack
# Remove files
rm -rf /opt/webstack
rm /usr/local/bin/webstack
# Optional: Remove Docker
apt remove docker-ce docker-ce-cli containerd.io # Debian/Ubuntu
dnf remove docker-ce docker-ce-cli containerd.io # AlmaLinuxQ: Can I run sites on different PHP versions simultaneously? A: Yes! Each site is completely isolated and can use any supported PHP version.
Q: How many sites can I host? A: Limited only by your server resources. We recommend 4-8 sites per 4GB RAM.
Q: Does this work with WordPress/Laravel/Drupal?
A: Yes! It works with any PHP application. Just upload files to the public/ directory.
Q: Can I use custom domains? A: Yes! Point any domain's DNS to your server and configure it during site creation.
Q: Are SSL certificates free? A: Yes! Traefik automatically generates free Let's Encrypt SSL certificates.
Q: How do I add more PHP extensions?
A: Create a custom Dockerfile or use the pre-installed docker-php-ext-install command.
Q: Can I use this in production? A: Absolutely! This is designed for production use with automatic SSL, monitoring, and backups.
- Documentation: Full documentation
- Issues: Report bugs
- Discussions: Community forum
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - See LICENSE file for details
Built with:
Made with ❤️ for developers who need flexibility without complexity