Deploying a Laravel application on cPanel requires proper configuration to ensure performance, security, and stability. In this guide, you’ll learn how to deploy Laravel on a live server using cPanel with a complete production-ready setup.
Video Tutorial
Step 1: Upload the Laravel Project
- Zip your Laravel project
- Go to cPanel → File Manager
- Upload to
public_htmlor subfolder - Extract files
Step 2: Move Public Folder Files
Laravel structure requires:
- Move the contents of
/public→public_html - Keep core files outside the public directory
Update index.php paths accordingly.
Step 3: Configure .env File
Update:
APP_ENV=production APP_DEBUG=false APP_URL=https://yourdomain.com
Also set database credentials.
Step 4: Set up Database
- Create a database in cPanel
- Import
.sqlfile (if needed) - Update
.env:
DB_DATABASE=your_db DB_USERNAME=your_user DB_PASSWORD=your_pass
Step 5: Install Dependencies
If terminal access is available:
composer install --optimize-autoloader --no-dev
If not:
- Upload the vendor folder manually
Step 6: Set Permissions
Set correct permissions:
storage → 775 bootstrap/cache → 775
Step 7: Generate App Key
php artisan key:generate
Step 8: Optimize for Production
Run:
php artisan config:cache php artisan route:cache php artisan view:cache
Common Issues
- 500 error → permissions or config
- CSS/JS not loading → wrong public path
- .env not working → clear cache
Pro Tips
- Always disable debug in production
- Use HTTPS
- Keep backups
If you want a smooth Laravel deployment without these issues:
👉 Try optimized Laravel hosting with proper server configuration