A fully automated and production-ready bash-based toolkit for deploying and managing Ubuntu 22.04.5 LTS servers with Laravel or generic PHP projects.
Automates the initial configuration of a fresh Ubuntu server.
- System update and cleanup
- Installs essential software:
- Nginx, MySQL, PHP (auto-detected version), Memcached
- Composer, Curl, Git, Ioncube Loader, Fail2ban, Certbot
- Creates
vdsadminuser withsudoand secure SSH access - Creates standard directory structure:
/home/vdsadmin/www— websites/home/vdsadmin/logs— logs/home/vdsadmin/certs— SSL certificates
- Configures:
- MySQL memory and performance settings
- PHP-FPM workers based on system RAM
- Nginx for optimal server performance
- Enables firewall and basic protection
- Logs to
/var/log/postinstall.logand/var/log/postinstall_pkg.log
Adds a new domain with Nginx and Let's Encrypt certificate in seconds.
- Creates new Nginx vhost for specified domain
- Supports Laravel or static/PHP projects
- Auto-detects PHP version
- Sets up directory:
/home/vdsadmin/www/<domain>and logs to/home/vdsadmin/logs/<domain>
- Issues SSL via Certbot with HTTP challenge
- Logs to
/var/log/adddomain.log
Initialization laravel project
sudo bash postinstall.shor
#!/bin/bash
wget https://raw.githubusercontent.com/barslg/postinstall/refs/heads/main/devops/postinstall.sh -O /root/postinstall.sh
/bin/bash /root/postinstall.shsudo bash addDomain.sh yourdomain.com [laravel]Example for Laravel:
sudo bash addDomain.sh example.com laravel- Ubuntu 22.04.5 LTS
- Root or
sudoprivileges - Domain with DNS pointing to server's public IP
- Open ports: 22, 80, 443, 873
/home/vdsadmin/
├── www/ # Web root for domains
│ └── example.com/
├── logs/ # Nginx logs per domain
├── certs/ # SSL certificates (if not using Certbot)
├── .ssh/ # SSH access for vdsadmin
- Uses
set -euo pipefailfor reliable execution - Non-interactive APT operations
- All configurations and logics are auditable
- Ensures minimal human interaction
- Auto-detects server specs (RAM, disk, CPU) and configures accordingly
Maintained by Oleksandr — built with ❤️ in Norway.