Start here: complete step-by-step guides

Laravel app: from composer create-project to live, step by step

Create a Laravel project, push it, set the web root, install with Composer, add .env and the scheduler.

  1. Create the project
  2. Push to GitHub
  3. Launch a PHP site
  4. Web root
  5. Prepare storage and .env (before the first deploy)
  6. What to put in .env
  7. Connect GitHub and deploy
  8. Once, after the first deploy
  9. Scheduler
  10. Go live on your domain

1. Create the project

composer create-project laravel/laravel my-app
cd my-app
php artisan serve          # http://127.0.0.1:8000

2. Push to GitHub

Laravel's .gitignore already keeps .env and vendor/ out. Push the project (see Put your code on GitHub).

3. Launch a PHP site

Launch an app → PHP & CMS → plan → domain → pay. Then Domains → PHP version: choose the version your composer.json needs (8.2 or newer for current Laravel).

4. Web root

App settings → Laravel → Save changes. This serves the public folder, as Laravel expects.

5. Prepare storage and .env (before the first deploy)

With Git deployments, storage and .env live outside the releases so they survive every deploy. Create them first — a first deploy without them answers with an error, and the health check would roll it back. On your computer run php artisan key:generate --show and copy the key it prints. Create the database under Databases. Then in the dashboard Terminal:

S=~/web/yourdomain.com/private/cn-shared
mkdir -p $S/storage/framework/cache/data $S/storage/framework/sessions $S/storage/framework/views $S/storage/logs $S/storage/app/public
nano $S/.env

What to put in .env

Paste this, fill in your values, save with Ctrl+O and Enter, exit with Ctrl+X. File sessions and cache work before any table exists.

APP_NAME="My App"
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:PASTE-THE-KEY
APP_URL=https://yourdomain.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=USER_dbname
DB_USERNAME=USER_dbuser
DB_PASSWORD=your-database-password
SESSION_DRIVER=file
CACHE_STORE=file
QUEUE_CONNECTION=sync

6. Connect GitHub and deploy

Git deployments → GitHub → repository → branch main. In Shared paths enter storage and .env (one per line). As Build command use the line below (change 8.3 to the PHP version you chose), then Deploy now. Add the webhook so pushes deploy by themselves.

composer install --no-dev --optimize-autoloader && php8.3 artisan migrate --force && php8.3 artisan config:cache && php8.3 artisan route:cache

7. Once, after the first deploy

cd ~/web/yourdomain.com/public_html
php8.3 artisan storage:link

8. Scheduler

Cron jobs → every minute:

cd /home/USER/web/yourdomain.com/public_html && php8.3 artisan schedule:run >> /dev/null 2>&1

Go live on your domain

Point the domain's @ and www A records to the IP shown in Domains, wait for Points here, then Issue free SSL → Always use HTTPS → Save changes.

Stuck? Our engineers answer support tickets around the clock. Contact us, or create an account and open a ticket from the dashboard — the same guides are there too.

Next step

Move your site, or your whole cloud estate

Shared hosting you can buy in two minutes. Infrastructure and managed services quoted by an engineer within one business day.