Deploying Laravel Applications

January 09, 2026 41 views

Deploying Laravel Applications

This guide walks you through complete Laravel deployment on CloudWeb hosting.

Prerequisites

  • SSH access to hosting (SSH guide)
  • GitHub repository with Laravel application
  • MySQL database (enabled in panel)

Step 1: Connect via SSH

ssh [email protected] -p PORT

Step 2: Generate GitHub Deploy Key

github_key

Add the displayed key to GitHub repository (Settings → Deploy keys).

Step 3: Clone the Repository

cd /var/www/html
git clone [email protected]:your-account/your-project.git .

Step 4: Install PHP Dependencies

composer install --optimize-autoloader --no-dev

Step 5: Install JavaScript Dependencies and Build Frontend

npm install
npm run build

Step 6: Configure .env

cp .env.example .env
nano .env

Edit these values:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_user
DB_PASSWORD=your_password

Step 7: Generate Application Key

php artisan key:generate

Step 8: Run Migrations

php artisan migrate --force

Step 9: Create Storage Symlink

php artisan storage:link

Step 10: Optimize for Production

php artisan config:cache
php artisan route:cache
php artisan view:cache

Step 11: Fix Permissions

fix_permissions

Updating the Application

For subsequent deployments:

cd /var/www/html
git pull origin main
composer install --optimize-autoloader --no-dev
npm install && npm run build
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
fix_storage

Was this article helpful?

Your feedback helps us improve our documentation

Still need help?

If this article didn't answer your question, our support team is here to help.

Contact Support