Skip to content

Deploy a Laravel App

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.

Updated View as Markdown

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

Choose Laravel in the New Site wizard

Open app.hostedez.com, click Sites → New site, and select Laravel.

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.

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:

# 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 for a complete workflow.

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):

public_html/.envdotenv
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.

Hosted EZ Browser Terminal running artisan about with Laravel quick command buttonsHosted EZ Browser Terminal running artisan about with Laravel quick command buttons

Run the initial deployment commands inside public_html:

# 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

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 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.
Hosted EZ PHP Settings tab showing PHP version selector and php.ini overridesHosted EZ PHP Settings tab showing PHP version selector and php.ini overrides
Navigation

Type to search…

↑↓ navigate↵ selectEsc close