---
title: "Deploy a Laravel App"
description: "Deploy and operate Laravel applications on Hosted EZ with public_html/public document root, Composer, Artisan, PHP 8.5, managed MariaDB, and scheduled cron jobs."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.hostedez.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy a Laravel App

Hosted EZ's **Laravel** runtime pre-installs a fresh Laravel application via `composer create-project laravel/laravel`, automatically points the web server document root to **`public_html/public`**, tunes PHP-FPM (`8.5` default, `8.4`, or `8.3`) with OPcache, and exposes `composer` and `artisan` directly in the Browser Terminal.

## 1. Create a Laravel site

1. **Choose Laravel in the New Site wizard**

   Open [app.hostedez.com](https://app.hostedez.com/dashboard?tab=sites&new=1), click **Sites → New site**, and select **Laravel**.
2. **Pick PHP version and optional MariaDB**

   Enter your site name, select your PHP branch (`8.5` recommended), and check **Include MariaDB database** if your app uses MySQL/MariaDB. Click **Create site**.
3. **Verify the document root**

   Hosted EZ configures Apache/nginx to serve from `public_html/public` automatically. Your `.env`, `app/`, `config/`, `storage/`, and `vendor/` directories live inside `public_html/` and are never exposed publicly.

## 2. Upload your Laravel code

Use **SFTP** (`sftp.hostedez.com:22`) with your SSH public key to upload your application into `public_html/`. Exclude local `vendor/`, `node_modules/`, `.git/`, and local `.env` files, and build frontend assets (Vite/Mix) before uploading:

```bash
# Build frontend assets locally (or in GitHub Actions)
npm ci
npm run build
```

Upload your repository files (including `public/build/`) to `public_html/` via `lftp` or GitHub Actions. See [SFTP & GitHub Actions CI/CD](/deploy/sftp-and-github-actions) for a complete workflow.

> **Symlinks are disallowed over SFTP**
>
> Hosted EZ's SFTP server refuses symlink uploads (`public/storage` cannot be uploaded as a symlink from your laptop). Run `artisan storage:link` inside the **Browser Terminal** after uploading instead.

## 3. Configure `.env` and MariaDB

If you provisioned a Managed MariaDB database (during site creation or in the **Databases** tab), open **Databases → select your database → Credentials** to copy the host, port, database name, username, and password.

Edit `public_html/.env` using the **File Manager** (or `nano .env` in the **Browser Terminal**):

```dotenv title="public_html/.env"
APP_NAME="Acme Portal"
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://portal.example.com

LOG_CHANNEL=stack
LOG_LEVEL=warning

DB_CONNECTION=mysql
DB_HOST=<your-mariadb-host>
DB_PORT=3306
DB_DATABASE=<your-database-name>
DB_USERNAME=<your-database-user>
DB_PASSWORD=<your-database-password>

SESSION_DRIVER=database
CACHE_STORE=database
QUEUE_CONNECTION=database
```

Hosted EZ automatically enforces `0600` permissions on `.env` files so only your site's isolated Linux user can read them.

## 4. Install dependencies & run Artisan commands

Open **Site → Terminal** in the dashboard. Hosted EZ pre-wires `php`, `composer`, and `artisan` functions pinned to your site's PHP branch and memory limit.

Run the initial deployment commands inside `public_html`:

```bash
# 1. Install production Composer dependencies
composer install --no-dev --optimize-autoloader --no-interaction

# 2. Generate APP_KEY (first deploy only)
artisan key:generate --force

# 3. Link public storage (if your app uses public disk uploads)
artisan storage:link

# 4. Run database migrations
artisan migrate --force

# 5. Cache config, routes, events, and views for production speed
artisan optimize

# 6. Verify environment and drivers
artisan about
```

> **Laravel Quick Commands**
>
> The Browser Terminal toolbar includes one-click buttons for `artisan about`, `artisan migrate:status`, `artisan optimize:clear`, `composer install --no-dev`, and `php -v`.

## 5. Run the Laravel Scheduler & Queues with Cron Jobs

Open **Site → Cron Jobs** to schedule recurring Artisan commands in UTC:

- **Laravel Scheduler** (every minute):
- **Schedule**: `* * * * *`
- **Command**: `php public_html/artisan schedule:run`
- **Timeout**: `120` seconds
- **Database Queue Worker** (batch drain every minute if you use queued jobs without a long-running daemon):
- **Schedule**: `* * * * *`
- **Command**: `php public_html/artisan queue:work --stop-when-empty --max-time=50`
- **Timeout**: `60` seconds

See [Scheduled Cron Jobs](/operations/cron-jobs) for timeout limits (`5–300 s`), run logs, and manual triggers.

## 6. Configure PHP & Outbound Email

- **PHP Settings**: Open **Site → PHP** to switch between PHP `8.3`, `8.4`, and `8.5` or tune `memory_limit`, `upload_max_filesize`, `post_max_size`, `max_execution_time`, and `date.timezone`.

- **Outbound Email**: Connect a Hosted EZ mailbox in **Site → Outbound Email** and set `MAIL_MAILER=sendmail` in `.env` (or use the mailbox's SMTP settings directly) for authenticated transactional email. See [Send Transactional Email from Your Site](/email/site-outbound-email).
- **Database Inspection**: Browse tables and run ad-hoc SQL queries directly in [Managed MariaDB & Database Studio](/databases/mariadb).

Source: https://docs.hostedez.com/deploy/laravel/index.mdx
