ArsalLocationStarter

Technical Review: Hostcry Engineering Team

Deploy Laravel App on cPanel – Complete Production Guide

AI Summary
To deploy Laravel on cPanel, upload your files and move the public folder contents to public_html. Update your .env for production, set up a database, and ensure the storage and cache folders have 775 permissions. Finally, run optimization commands to ensure a fast, secure, and stable live site.

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_html or subfolder
  • Extract files

Step 2: Move Public Folder Files

Laravel structure requires:

  • Move the contents of /publicpublic_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 .sql file (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