Step 1: Provision and Secure VPS
- Deploy Ubuntu 22.04/24.04 VPS and connect with SSH.
- Create non-root user and grant sudo.
- Allow firewall ports 22, 80, and 443.
sudo adduser deploy && sudo usermod -aG sudo deploysudo ufw allow OpenSSH && sudo ufw allow 'Nginx Full' && sudo ufw enableStep 2: Install Required Packages for Laravel and Node
sudo apt update && sudo apt install -y nginx apache2 mysql-server mariadb-server redis-server supervisor git unzip curl software-properties-commonsudo apt install -y php8.2-fpm php8.2-cli php8.2-mysql php8.2-curl php8.2-xml php8.2-mbstring php8.2-zip php8.2-gd php8.2-bcmath php8.2-intlcurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejscurl -sS https://getcomposer.org/installer | php && sudo mv composer.phar /usr/local/bin/composersudo npm install -g pm2Step 3: Create Database and Import/Seed SQL
Use MySQL or MariaDB (pick one). Create DB/user and grant privileges:
sudo mysql -u root -pCREATE DATABASE luminaai_live CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;CREATE USER 'luminaai_user'@'localhost' IDENTIFIED BY 'strong_password';GRANT ALL PRIVILEGES ON luminaai_live.* TO 'luminaai_user'@'localhost'; FLUSH PRIVILEGES;Import SQL manually or run migrations:
mysql -u luminaai_user -p luminaai_live < /path/to/backup.sqlphp artisan migrate --force && php artisan db:seed --forcephp artisan make:filament-userStep 4: Upload and Deploy Project on VPS
cd /var/www && sudo git clone <your-repo-url> luminaaicd /var/www/luminaai && cp .env.example .envcomposer install --no-dev --optimize-autoloadernpm ci && npm run buildphp artisan key:generate --forcephp artisan storage:linkphp artisan migrate --force && php artisan config:cache && php artisan route:cache && php artisan view:cachesudo chown -R www-data:www-data /var/www/luminaai && sudo chmod -R 775 /var/www/luminaai/storage /var/www/luminaai/bootstrap/cacheStep 5: Configure Domain, Nginx/Apache, and SSL Certificate
Point domain A record to VPS IP, then configure Nginx server block:
sudo nano /etc/nginx/sites-available/luminaaisudo ln -s /etc/nginx/sites-available/luminaai /etc/nginx/sites-enabled/sudo nginx -t && sudo systemctl reload nginxsudo apt install -y certbot python3-certbot-nginxsudo certbot --nginx -d yourdomain.com -d www.yourdomain.comIf using Apache instead of Nginx, enable required modules and vhost:
sudo a2enmod rewrite ssl headers proxy_fcgi setenvifsudo a2enconf php8.2-fpm && sudo systemctl restart apache2Step 6: Process Management (Queue, Scheduler, PM2, Services)
Create production jobs for Laravel queue, scheduler, and optional Node service:
php artisan queue:work --tries=3 --timeout=120 --sleep=3 --max-time=3600* * * * * cd /var/www/lumina && php artisan schedule:run >> /dev/null 2>&1php artisan horizonpm2 start npm --name lumina-node -- run startpm2 save && pm2 startupsudo systemctl enable nginx php8.2-fpm mysql redis-server supervisorWebsite URL: https://yourdomain.com | Filament admin: https://yourdomain.com/admin.
Troubleshooting (VPS)
- 502/504 from Nginx: check
php8.2-fpmstatus and socket path in Nginx config, then reload Nginx. - 403 forbidden: verify Nginx/Apache root is Laravel
publicand correct owner/permissions are set. - Queue jobs not processing: confirm supervisor program is running, check worker logs, and restart queue worker.
- Scheduler not running: validate cron entry with full project path and check server timezone consistency.
- SSL not issuing: make sure DNS A records already point to VPS, ports 80/443 are open, and rerun Certbot.
- Filament/admin session issues: verify
APP_URL, trusted proxy config (if behind CDN), and secure cookie settings after HTTPS cutover.