A powerful bash-based control panel for managing LAMP stack (Linux, Apache, MySQL/MariaDB, PHP) and virtual hosts on Ubuntu systems.
public/ directory for frameworksgit clone https://github.com/yourusername/lamp-control-panel.git
cd lamp-control-panel
chmod +x lampctl.sh
sudo ln -s $(pwd)/lampctl.sh /usr/local/bin/lampctl
./lampctl.sh
This launches an interactive menu where you can choose from all available options.
# Apache Controls
./lampctl.sh start # Start Apache
./lampctl.sh stop # Stop Apache
./lampctl.sh restart # Restart Apache
# Database Controls
./lampctl.sh startdb # Start MySQL/MariaDB
./lampctl.sh stopdb # Stop MySQL/MariaDB
./lampctl.sh restartdb # Restart MySQL/MariaDB
# Virtual Host Management
./lampctl.sh add # Add new virtual host
./lampctl.sh list # List all virtual hosts
./lampctl.sh remove # Remove virtual host
When you choose βAdd Virtual Hostβ (option 7), the script will:
/var/www/html)public/ as document rootmyapp.test)/etc/hostsProject path: my-laravel-app
Domain: myapp.test
This creates:
/var/www/html/my-laravel-appmyapp.testhttp://myapp.testThe script organizes projects under /var/www/html/ by default:
/var/www/html/
βββ project1/
β βββ public/ # Laravel projects auto-detected
βββ project2/
β βββ index.php # Standard PHP projects
βββ wordpress/
βββ wp-config.php # WordPress detected
/etc/apache2/sites-available//etc/apache2/sites-enabled//etc/hosts/var/www/html/ (configurable in script)/var/log/apache2/domain_error.logYou can modify these variables at the top of the script:
APACHE_SITES_AVAILABLE="/etc/apache2/sites-available"
APACHE_SITES_ENABLED="/etc/apache2/sites-enabled"
HOSTS_FILE="/etc/hosts"
PROJECTS_BASE="/var/www/html"
chmod +x lampctl.shsudo apache2ctl configtestsudo systemctl status apache2sudo a2ensite your-domain.confcat /etc/hostssudo systemctl reload apache2Add set -x at the top of the script for detailed debugging output.
MIT License - Copyright (c) 2025 Attila
If you encounter any issues:
sudo tail -f /var/log/apache2/error.logNote: This script is designed for development environments. Use caution in production environments and always test configurations thoroughly.