Deploy Guide · PHP

Deploy a Laravel App

From artisan to production — in one git push.

Overview

Laravel is the most popular PHP framework for modern web applications. Deploying Laravel to a production server has historically required setting up PHP-FPM, nginx, SSL, and queue workers manually. Kubeletto packages all of this into a container and manages the infrastructure for you.

Prerequisites

  • Laravel 10+ project with composer.json
  • APP_KEY and database credentials ready as environment variables
  • A Kubeletto account

Step-by-Step Guide

Deploying Laravel to Kubeletto is done by configuring a Dockerfile, connecting your GitHub repository, and setting environment variables. Follow this step-by-step checklist to deploy your code:

  1. 1

    Write a Laravel Dockerfile

    Use PHP-FPM with nginx as a process supervisor, or use Octane for high performance.

    dockerfile
    FROM php:8.3-fpm-alpine
    RUN apk add --no-cache nginx supervisor
    RUN docker-php-ext-install pdo pdo_mysql opcache
    COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
    WORKDIR /var/www
    COPY . .
    RUN composer install --no-dev --optimize-autoloader
    RUN php artisan config:cache && php artisan route:cache
    COPY docker/nginx.conf /etc/nginx/nginx.conf
    COPY docker/supervisord.conf /etc/supervisord.conf
    EXPOSE 80
    CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
  2. 2

    Configure Laravel for containers

    Set LOG_CHANNEL=stderr so logs stream to Kubeletto's log collector.

    bash
    # .env.production (values injected via Kubeletto env)
    APP_ENV=production
    LOG_CHANNEL=stderr
    SESSION_DRIVER=redis
    CACHE_DRIVER=redis
  3. 3

    Deploy

    Connect your GitHub repo to Kubeletto and push.

    bash
    kubeletto env set APP_KEY=base64:your-key --app laravel-app
    kubeletto env set DATABASE_URL=mysql://user:pass@host:3306/dbname --app laravel-app
    kubeletto deploy --source github --repo your-org/laravel-app --branch main

Sample Environment Variables

To configure your Laravel application, set these key-value pairs in the environment variables tab of the Kubeletto console or CLI. Ensure production secrets are flagged as write-only:

.env
APP_ENV=production
APP_KEY=base64:your-32-char-key
DB_CONNECTION=mysql
DATABASE_URL=mysql://user:pass@host:3306/dbname
REDIS_URL=redis://...
QUEUE_CONNECTION=redis
LOG_CHANNEL=stderr

Related Kubeletto Features

Kubeletto offers automatic SSL certificate provisioning, zero-downtime rollbacks, and scale-to-zero autoscaling for Laravel container workloads:

PaaS Platform Comparisons

See how Kubeletto compares directly against other cloud platforms and PaaS providers when deploying PHP workloads:

Frequently Asked Questions

Find direct answers to common questions about hosting, building, scaling, and managing Laravel containerized apps on Kubeletto:

Should I use Laravel Octane on Kubeletto?

Laravel Octane (with Swoole or RoadRunner) significantly improves throughput for high-traffic APIs. It works perfectly on Kubeletto — just adjust your CMD to start Octane instead of PHP-FPM.

How do I run Laravel queue workers on Kubeletto?

Deploy a second Kubeletto app from the same codebase with CMD set to `php artisan queue:work`. Configure it with the same environment variables as your web app.

Where should I store Laravel storage/ files?

Use S3-compatible object storage. Container filesystems are ephemeral — uploaded files stored locally won't survive a redeploy.

Deploy your Laravel app today

Free during our active beta. No credit card required.

Start Deploying Free