Web Hosting

How to Build and Host a Laravel Website on Hostinger: Complete Step-by-Step Guide

A Admin · Nov 25, 2026 · 6 min read

Laravel is one of the most popular PHP frameworks, and Hostinger is a common choice for hosting it because its plans are affordable and its higher shared plans include SSH and Composer. This guide walks through the whole journey — from picking a plan to a live, secure website — using the same steps we used for our own platform.

Menu names in hPanel change from time to time, but the steps stay the same. Always check the current plan details on Hostinger’s site before buying.

What you need before you start

  • A Laravel project (new or existing) that runs on your computer.
  • A Hostinger plan that includes SSH access — check the plan comparison; shared plans from Premium upwards and Cloud plans list it.
  • A domain name connected to that hosting plan.
  • About 30–45 minutes.

If you don’t have hosting yet, you can get Hostinger through our link — it costs you nothing extra and supports this website.

Step 1: Choose the right plan

For a small or medium Laravel site (business site, blog, small store, learning platform), a shared plan with SSH is usually enough. Move to Cloud or a VPS when you need more guaranteed resources, background queue workers running all the time, or websockets.

Shared vs Cloud vs VPS in one line each

  • Shared (with SSH): cheapest, managed for you, perfect to start.
  • Cloud: more resources and isolation, still managed through hPanel.
  • VPS: full server control — you manage updates and security yourself.

Step 2: Prepare hPanel

  1. PHP version: open your website’s PHP Configuration and choose a PHP version your Laravel version supports (Laravel 12 needs PHP 8.2 or newer).
  2. SSH: enable SSH access and note the host, port, username and password.
  3. Database: create a MySQL database and user. Write down the database name, username and password.
  4. Email: create an address such as no-reply@yourdomain.com for password-reset and contact-form emails.
  5. SSL: install the free SSL certificate so your site runs on HTTPS.

Step 3: Connect over SSH

On Windows use PowerShell, on Mac or Linux use Terminal. Hostinger shared hosting typically uses a non-standard SSH port — use the one shown in hPanel.

ssh -p 65002 u123456789@your-server-ip
cd ~/domains/yourdomain.com

Step 4: Put your Laravel code on the server

You have three common options:

  • Composer (fresh install): composer2 create-project laravel/laravel app
  • Git: git clone https://github.com/you/your-project.git app
  • Upload a ZIP with File Manager, then unzip project.zip -d app

Keep the project in its own folder (here app) next to public_html, not inside it. That way your .env file and source code are never reachable from the web.

If you uploaded code without the vendor folder, install the packages:

cd app
composer2 install --no-dev --optimize-autoloader

Step 5: Configure the .env file

cp .env.example .env   # only if .env doesn't exist yet
php artisan key:generate
nano .env

Set at least these values:

APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com

DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=u123456789_site
DB_USERNAME=u123456789_admin
DB_PASSWORD=your-password

MAIL_MAILER=smtp
MAIL_HOST=smtp.hostinger.com
MAIL_PORT=465
MAIL_SCHEME=smtps
MAIL_USERNAME=no-reply@yourdomain.com
MAIL_PASSWORD=your-email-password

Never leave APP_DEBUG=true on a live site — it can show passwords and file paths to visitors when an error happens.

Step 6: Build the database

php artisan migrate --force
php artisan db:seed --force   # only if your project has seeders you want
php artisan storage:link

Step 7: Point the domain to Laravel’s public folder

Hostinger serves your domain from public_html, but Laravel must be served from its own public folder. The cleanest fix is to replace public_html with a link:

cd ~/domains/yourdomain.com
mv public_html public_html_old
ln -s app/public public_html

Open your domain — the Laravel site should load. If you see an error instead, undo with rm public_html && mv public_html_old public_html and use the fallback: copy the contents of app/public into public_html and change the paths in public_html/index.php from __DIR__.'/../' to __DIR__.'/../app/'.

Step 8: Speed it up

cd ~/domains/yourdomain.com/app
php artisan config:cache
php artisan route:cache
php artisan view:cache

Run these again after every update. If something looks old after a change, clear the caches with php artisan optimize:clear.

Step 9: Add one cron job for the scheduler

If your app uses Laravel’s scheduler (daily imports, reminders, cleanups), add a cron job in hPanel that runs every minute:

cd /home/u123456789/domains/yourdomain.com/app && php artisan schedule:run >> /dev/null 2>&1

Step 10: Security and backups checklist

  • HTTPS is on and HTTP redirects to HTTPS.
  • APP_DEBUG=false and a strong APP_KEY.
  • Your .env is outside the web folder (it is, if you followed step 4).
  • Admin accounts use strong, unique passwords.
  • Automatic backups are enabled, and you download a copy of the database and storage folder now and then.

Updating your site later

cd ~/domains/yourdomain.com/app
git pull            # or upload and unzip the new files
composer2 install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan optimize:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache

Common problems and fixes

“500 Server Error” after upload

Check storage/logs/laravel.log. The usual causes are a missing APP_KEY, wrong database details in .env, or missing vendor folder.

Images upload but don’t show

Run php artisan storage:link and make sure APP_URL matches your real domain with https.

Composer says your PHP version is too old

Over SSH, Composer uses the plan’s default PHP version, which can differ from the website’s version. Set the default PHP version in hPanel and reconnect.

“419 Page Expired” on forms

Usually a session or cache problem after changing .env. Run php artisan optimize:clear and try again.

Wrapping up

That’s the full path from an empty hosting account to a live Laravel website: prepare hPanel, upload the code outside public_html, configure .env, migrate, link the public folder, cache, and add one cron job. Once it is set up, updates take a couple of minutes.

Prefer to have it done for you? Our web development and hosting service handles the whole setup, and you can see an example in our projects.

A
Written by AdminAffiliate Marketing · IT Services · Learning
H
Recommended: Hostinger

Web hosting, domains and website builder — great for beginners and small businesses.

Get Hostinger