๐Ÿš€ Promote your brand here โ€” Reach our amazing audience!
Home / articles / laravel deployment notes and hacks

Laravel Deployment: Important Notes and Hacks

By Hisham ยท Published on October 06, 2025

Deploying a Laravel application can be tricky if you are not familiar with server setups. Here is a step-by-step guide to help you deploy your Laravel app efficiently.

1. Prepare Your Build

  • Before deployment, run npm run build to compile your assets if you are using Vite.

  • Zip your local project files (excluding unnecessary files like node_modules) to upload them easily.

2. Upload to Server

  • Upload the zip file to your server via FTP or the hosting control panel.

  • Extract the files outside the public_html directory, for example in a folder called laravel.

  • Delete the existing public_html folder or rename it to something else for backup.

3. Set Public Directory

  • Using SSH, create a symbolic link from the Laravel public folder to public_html:

cd [path/to/yourdomain]
ln -s ./laravel/public /public_html

files shape

4. Storage Link

  • Create a storage link to access uploaded files:

cd laravel/public
rm storage #if exists
ln -s ../storage/app/public storage

files

5. Fix Vite Error (tring to hot reload)

  • go to the public folder

  • delete the hot file

  • now vite will work without

6. Configure Environment

  • Edit the .env file and update the database credentials:

DB_DATABASE=your_db_name

DB_USERNAME=your_db_user

DB_PASSWORD=your_db_password

7. Clean Up

  • Search for any hot files in the public directory and delete them to avoid conflicts.

  • Clear caches if needed:

php artisan config:cache

php artisan route:cache

php artisan view:cache

7. Additional Tips & Hacks

  • Set proper folder permissions for storage and bootstrap/cache.

  • Use php artisan migrate --force for production migrations.

  • Keep a backup of the old public_html for safety.

  • Check that APP_URL in .env matches your domain.

By following these steps, your Laravel application should run smoothly on shared hosting or a VPS environment.

๐Ÿš€ Promote your brand here โ€” Reach our amazing audience!