Deploy Laravel on UnderHost VPS and Shared Hosting
Deploy Laravel web applications on UnderHost shared hosting or VPS. Configure environment, database, Artisan commands, and production optimization.
On this page
Laravel is the most popular PHP framework for building modern web applications. It includes everything: routing, ORM (Eloquent), s, authentication, queuing. Whether on UnderHost shared hosting or VPS, Laravel deployment involves the same fundamental steps.
Requirements
- UnderHost Hosting (shared hosting or VPS)
- PHP 8.0+ (check your hosting control panel)
- Composer for dependency management
- MySQL or MariaDB for database
- SSH access (VPS) or FTP (shared hosting)
Upload Laravel Project
Option 1: Via SSH/Git (VPS/Dedicated):
cd /home/username/public_html
git clone https://github.com/yourname/myapp.git
cd myapp
Option 2: Via FTP (Shared Hosting):
- Download your Laravel project on your computer
- Connect via FTP (FileZilla, WinSCP)
- Upload to public_html folder
Install Dependencies (Composer)
Check if Composer is installed:
composer --version
If not installed, get Composer and install dependencies:
cd /home/username/public_html/myapp
composer install
This reads composer.json and installs all Laravel dependencies into vendor/ folder.
Environment Configuration
Copy example environment file:
cp .env.example .env
Generate application key:
php artisan key:generate
Edit .env with your database credentials:
APP_NAME=MyApp
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=username_myapp
DB_USERNAME=username_user
DB_PASSWORD=your_strong_password
Database Setup
In cPanel (Shared Hosting):
- Create MySQL database:
username_myapp - Create user with password
- Grant all permissions to user on database
Run Laravel s:
php artisan migrate
This creates database tables from your files.
File Permissions
Laravel storage directories need write access:
# Via SSH
chmod -R 775 storage bootstrap/cache
# Via FTP or File Manager
Set permissions to 755 for storage/ and bootstrap/cache/
Shared Hosting vs VPS
| Aspect | Shared Hosting | VPS |
|---|---|---|
| Deployment | FTP + cPanel → easy | Git clone or SFTP → more control |
| Composer | May need to upload vendor/ folder via FTP | Run composer install on server |
| Artisan Commands | May not work directly; contact support | Full SSH access: php artisan migrate |
| Queue Jobs | Not available (no background tasks) | Use Redis + Supervisor for queues |
| SSL/HTTPS | Auto-renewing Let's Encrypt in cPanel | Manual or aaPanel/CloudPanel auto SSL |
Production Optimization
Cache configuration and routes:
php artisan config:cache
php artisan route:cache
php artisan view:cache
Set proper APP_DEBUG and error handling:
# .env
APP_DEBUG=false
LOG_CHANNEL=single
Use queue jobs for long tasks (VPS only):
# queue:listen runs on VPS, processes background jobs
php artisan queue:listen
Enable lazy loading protection:
# config/database.php
'postgresql' => [
// ...
'strict' => true,
],
Many hosting providers (including some UnderHost VPS plans with aaPanel/CloudPanel) support one-click Laravel deployment. Check your control panel's app marketplace.
Related: PHP deployment | Composer package manager | Laravel optimization tips
Need a developer-friendly server?
Use an UnderHost Cloud VPS for SSH, Git, Node.js, Python, Laravel, Docker, cron, and custom development workflows.





















