Skip to content

Laravel Deployment: A Production Checklist

A practical Laravel production deployment checklist based on the official docs: requirements, web server, optimize commands, workers, health checks and rollback.

To deploy a Laravel application to production, you need a server with the required PHP version and extensions, a web server that sends every request to public/index.php, writable storage and bootstrap/cache directories, production environment settings, and a repeatable set of release steps that cache configuration and restart workers. The details below follow the official Laravel deployment documentation where it covers them, so check the docs for your framework version before you copy anything.

This guide is about the mechanics of a production release. It is not a hosting comparison, and it works whether you use a VPS, a managed platform or containers.

The short answer

A safe release has the same shape every time:

  1. Put the new code on the server.
  2. Install dependencies without dev packages.
  3. Run migrations.
  4. Cache configuration, routes, views and events.
  5. Restart long-running processes.
  6. Check the health route and the logs.

Write these steps into a script or CI job so no one performs them by hand from memory.

Step 1: Meet the server requirements

Laravel documents a minimum PHP version and a list of extensions. In the 12.x docs the list includes Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer and XML. The minimum PHP version differs between framework versions, so read the page for the version you run.

Check what is installed on the server:

php -v
php -m

Your application may also need extensions beyond that list, for example for your database driver or image handling.

Step 2: Configure the web server

Point the document root at the public directory and send all requests to public/index.php. Do not serve the project root. The docs warn that doing so exposes sensitive configuration files to the public internet.

The docs provide an Nginx starting point. Its key parts are root /srv/example.com/public;, a try_files $uri $uri/ /index.php?$query_string; rule, a PHP-FPM handler for index.php, and a rule that denies dotfiles except .well-known. Treat it as a starting point and adapt it to your server. The docs also describe FrankenPHP as an alternative way to serve a Laravel application.

Make sure the web server user can write to storage and bootstrap/cache.

Step 3: Set production environment values

Create the .env file on the server, not in the repository. Do not commit secrets.

The most important setting is debug mode. The docs state that in production APP_DEBUG should always be false, because true risks exposing sensitive configuration values to users.

APP_ENV=production
APP_DEBUG=false

Also set a unique APP_KEY, your database credentials, the cache and queue drivers and your mail settings. Keep a list of required variables in .env.example so a new environment is not a guessing game.

Step 4: Release steps

A typical release script looks like this:

composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan optimize
php artisan reload

What each step does:

  • composer install --no-dev --optimize-autoloader installs only production dependencies.
  • php artisan migrate --force runs pending migrations without the interactive production prompt.
  • php artisan optimize caches configuration, events, routes and views in one command. The docs also describe the individual commands: config:cache, event:cache, route:cache and view:cache.
  • php artisan reload terminates reloadable long-running services so they pick up the new code. The docs say that if you are not on Laravel Cloud, you need a process monitor that restarts them when they exit.

One trap deserves attention. After config:cache, the .env file is no longer loaded, so calls to env() outside config files return null. Use env() only inside files in config/, and read values elsewhere with config().

To undo the caches, run php artisan optimize:clear. Per the docs, it also removes all keys in the default cache driver, so use it with care on a live site.

Step 5: Queues and the scheduler

If your application uses queues, run workers under a process manager such as Supervisor or systemd so they restart after a crash or a reload. Workers keep the old code in memory, so they must be restarted on every release.

If you use the scheduler, add the single cron entry that runs php artisan schedule:run every minute, as described in the scheduling docs. Check that only one server runs it unless you have set up overlap protection.

Step 6: Health checks and monitoring

Laravel includes a health route, served at /up by default, which returns a 200 response if the application booted without exceptions. Use it for your uptime monitor, load balancer or orchestrator. You can listen to the DiagnosingHealth event to add checks for the database or cache.

After each release, look at the application log and your error tracker. A passing health route does not prove your checkout, login or queue jobs work, so add a short smoke test for your critical paths.

Rollback thinking

Decide how you will go back before you need to. Keep the previous release available, make migrations backward compatible when you can (add columns first, remove them in a later release) and keep a database backup before risky migrations. Releasing in a way that avoids downtime depends on your setup, so verify it in a staging environment rather than assuming it.

Deployment mistakes we see

Running with debug on. It is the quickest way to leak configuration.

Forgetting to restart workers. The site shows new code while queued jobs run old code.

Using env() in application code. It works locally and fails after caching.

Deploying by dragging files. Without a script, steps get skipped and no one can reproduce the release.

Migrating without a backup. Test migrations on a copy of production data first.

Worked checklist

Before each release, confirm:

  • Tests pass in CI.
  • New environment variables are in .env.example and set on the server.
  • Migrations are reviewed for locking and backward compatibility.
  • The release script runs the steps in order.
  • Workers restart.
  • The health route and key pages respond after the release.
  • You know the rollback steps.

How we work with this at LaunchSprintAI

We build Laravel products and set up repeatable release steps as part of delivery, so deployment is a script and not a ritual. AI tools help our engineers draft and review parts of the work, and people check the configuration, migrations and release process. If you are planning a Laravel product, see MVP development or start a project brief. For a comparison of hosting models, read Managed Hosting vs VPS.

For the authoritative and current version of these steps, see the Laravel deployment documentation.

Related reading

Related services

Also on LaunchSprintAI

Our hosting

Built your app with AI? Get it online.

MoodLensAI runs apps made with Claude Code, Codex or Cursor, plus n8n, WordPress and Laravel, on a managed server with HTTPS, backups and monitoring. Fixed monthly plans, no server administration.