Skip to content
COL0

How to deploy a Laravel app on a VPS (beginner's guide)

Your Laravel project works with php artisan serve, but online you get a 500 error or a blank page. Here is the full map to take it to production without surprises.

Written by Victor Barrera

What you need before starting

  • A Linux server (Ubuntu is the best documented choice) with SSH access.
  • PHP with the extensions your Laravel version requires, Composer and a web server (Nginx or Apache).
  • A database (MySQL or PostgreSQL) and a domain.
  • Your code in a repository (GitHub or GitLab).

The steps, in short

  1. Prepare the server: create a non-root user, enable the firewall and update packages.
  2. Install PHP, Composer and Nginx and create the database with a dedicated user for your app.
  3. Clone the project and run composer install --no-dev --optimize-autoloader.
  4. Create the .env file with production values: APP_ENV=production, APP_DEBUG=false, the database and the APP_KEY (php artisan key:generate).
  5. Point Nginx to the public/ folder, never to the project root. That way nobody can read your .env.
  6. Run the migrations with php artisan migrate --force and cache the configuration with php artisan config:cache.
  7. Give write permissions on storage/ and bootstrap/cache/ to the web server user.
  8. Enable HTTPS with a free Let’s Encrypt certificate.

Common mistakes

  • Leaving APP_DEBUG=true in production: it exposes passwords and internal paths.
  • Forgetting php artisan storage:link, so uploaded images do not show.
  • Not setting up the task scheduler (cron) or the queue worker, so emails and jobs never go out.
  • Committing the vendor/ folder or the .env file to the repository.

How we help

In the free session we review your project and tell you which server fits. Then we put it online with a domain, HTTPS, automatic deploys and backups, or we guide you so you do it yourself.

Frequently asked questions

Can I deploy Laravel on shared hosting?

Yes, if the host lets you point the domain to the public/ folder and offers a PHP version compatible with your Laravel version. For projects with queues, scheduled tasks or a lot of traffic, a VPS is a better fit.

Why do I get a 500 error after uploading my app?

Almost always one of three things: the .env file is missing, the storage/ and bootstrap/cache folders are not writable, or PHP extensions are missing. The log at storage/logs/laravel.log tells you which.

Ready to publish your project?

Book your free 30-minute session and leave with a clear plan.

Book your free session