Home / Blog / Web Development / How to Deploy Your Laravel Application to a VPS — Step by Step
📝
Web Development June 30, 2026 • 1 min read • 👁 1,030 views

How to Deploy Your Laravel Application to a VPS — Step by Step

A

Admin

Author

Prerequisites

You need a VPS running Ubuntu 22.04, a domain name pointed at your server, and SSH access.

Step 1: Install Dependencies

Install PHP 8.2, Nginx, MySQL, and Composer on your server. Use the apt package manager and follow the official installation guides for each.

Step 2: Clone Your Repository

Clone your Laravel project into /var/www/your-app and set the correct file permissions for the storage and bootstrap/cache directories.

Step 3: Configure Environment

Copy .env.example to .env, fill in your production database credentials, set APP_ENV=production and APP_DEBUG=false.

Step 4: Configure Nginx

Create an Nginx server block pointing to your Laravel public directory. Set the root to /var/www/your-app/public.

Step 5: SSL with Let's Encrypt

Use Certbot to generate a free SSL certificate. Run certbot --nginx -d yourdomain.com and follow the prompts.

Step 6: Production Optimization

Run php artisan optimize to cache config, routes, and views. Set up a cron job for Laravel's task scheduler.

Share this article