How to deploy Laravel to your own VPS.

To deploy a Laravel app to a VPS you need a server with Nginx, PHP, Composer and a database, a checkout of your repository, a build step, and a way to switch releases without downtime. ServerDog sets all of that up from your Mac: it installs the stack on a fresh Ubuntu server, creates the site and its database, and deploys from Git. This guide walks through it.

By ServerDog. Updated .

Key facts

  • A Laravel app on a VPS needs Nginx, PHP with Composer, a database, and usually Redis and Node.js. ServerDog installs these on a fresh Ubuntu 24.04 or 26.04 server in about 8 to 12 minutes.
  • The Laravel preset deploys with zero downtime by default: Composer, the asset build and migrations run in a new release folder before the site switches to it.
  • Each site gets its own read-only deploy key, created on the server.
  • Deploy on Push deploys your branch within a minute of each commit, with no webhook.

Before you start

  • A Mac running macOS 15 or later, with ServerDog installed.
  • A Hetzner or DigitalOcean account, or a fresh Ubuntu 24.04 or 26.04 server from any provider.
  • Your Laravel app in a GitHub, GitLab or Bitbucket repository.
  • A domain whose DNS you can change.

1. Set up the server

Choose Add Server. To create a new server, pick New server at a provider, then a region and size. To use one you already have, enter its address and choose the SSH key.

Pick App server as the type, the PHP version your app needs and a database. ServerDog then installs Nginx, PHP and Composer, the database, Redis, Node.js and Supervisor, and sets up the firewall. Setup usually takes 8 to 12 minutes and runs on the server, so you can close the window or put your Mac to sleep while it works.

2. Create the site

Choose New Site and the Laravel preset. Type the domain, pick the PHP version, and add the repository URL and branch. ServerDog writes the Nginx config and creates a database and user for the site.

The site gets its own read-only deploy key. Connect a GitHub, GitLab or Bitbucket account in Settings and ServerDog adds the key to the repository for you; otherwise, copy it into the repository’s deploy keys yourself.

3. Set the environment

ServerDog writes the site’s .env with a freshly generated APP_KEY and the database name, user and password from the previous step. Open the site’s Environment tab to add the rest: mail settings and any API keys.

4. Deploy

Press Deploy. The Laravel preset’s script builds a new release and switches to it only when it’s ready:

$CREATE_RELEASE()

cd $SERVERDOG_RELEASE_DIRECTORY

$SERVERDOG_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader
npm ci
npm run build
$SERVERDOG_PHP artisan migrate --force

$ACTIVATE_RELEASE()

$RESTART_QUEUES()

You can watch each phase and the log as it streams. If something fails before the switch, the site keeps serving the previous release. Read how zero-downtime deploys work.

5. Point the domain and turn on HTTPS

Create a DNS record for your domain that points at the server’s IP address. ServerDog waits for DNS, requests a free certificate and shows how long it is valid. The server renews it from then on.

6. Add queues and the scheduler

In the site’s Settings, under Processes, Laravel sites have three switches and a list:

  • Scheduler. Runs php artisan schedule:run every minute in the live release.
  • Horizon. Runs php artisan horizon, which manages your queue workers. Deploys restart it.
  • Inertia SSR. Runs php artisan inertia:start-ssr, if your build makes the SSR bundle.
  • Processes. Add a queue worker, or any other command that should keep running.

7. Turn on Deploy on Push

In the site’s deploy settings, turn on Deploy on Push. The server checks the repository itself and deploys your branch within a minute of each new commit. There is no webhook to set up, and your Mac doesn’t need to be on.

What you end up with

A plain Ubuntu server running Nginx, PHP-FPM, your database and Redis, with your Laravel app deployed in release folders and served over HTTPS. Nothing on it is tied to a hosted service: remove the server from ServerDog and it keeps running exactly as it is.

Go deeper

Questions

What do I need to deploy Laravel to a VPS?

A server with Nginx, PHP with the extensions Laravel needs, Composer, a database such as MySQL, MariaDB or PostgreSQL, and usually Redis, Node.js for building assets and Supervisor for queue workers. You also need a way to get your code onto the server and switch releases safely.

Can I deploy Laravel without managing a server by hand?

Yes. A server panel does the setup for you. ServerDog installs the whole stack on a fresh Ubuntu server from a Mac app, creates the site and database, and deploys from Git, so you never edit an Nginx file or run apt yourself.

How do I deploy Laravel with zero downtime?

Build each release in its own folder and switch the live link to it only when the build has finished. ServerDog’s Laravel preset does this by default: Composer, the asset build and migrations run in the new release, then the site switches over.

Which VPS providers can I use for Laravel?

Any provider with Ubuntu 24.04 or 26.04. ServerDog creates servers at Hetzner and DigitalOcean from inside the app, and you can add a server from any other provider by its address and SSH key.

Does ServerDog run Laravel migrations?

Yes. The default deploy script runs php artisan migrate --force in the new release before the site switches to it. You can change or remove that line in the script.

How do I run Laravel queues and Horizon on a VPS?

In the site’s process settings, turn on Horizon or add a queue worker. ServerDog keeps it running as a systemd service, restarts it whenever it stops, and restarts it at the end of each deploy.

Last updated by ServerDog.

Your servers. Your Mac. Nothing in between.

For macOS 15 or later.