Limited time offer: Get .COM at ₦10000 Use NGNEWCOM
India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Canada English
Canada Français
Somalia English
Netherlands Nederlands

How to Deploy Laravel on Shared Hosting 

Buy domains, business emails, hosting, VPS and more: Get Started

Cheapest Domains in Nigeria

Get your .COM.NG domain now for just ₦5,500 (Back to 7K in 7 days)

.COM.NG for ₦5,500 | .COM for ₦12000: Coupon NEWCOM

Have you tried putting your Laravel app online and ended up frustrated with errors, slow loading, or confusing steps? 

You’re not alone. Many developers in Nigeria struggle with this, especially when working on small projects or side businesses with limited time and money.

You want your app to be live fast, but you don’t want to spend hours figuring out servers. 

Shared hosting is the answer. It’s cheap, beginner-friendly, and perfect for small projects.

In this guide, you’ll learn how to deploy Laravel on shared hosting in simple steps. 

By the end, your app will be live, fast, and ready for users. You’ll learn:

  • What Laravel and shared hosting are
  • Why shared hosting works well for small projects
  • Step-by-step deployment using cPanel
  • Common problems and how to fix them
  • Tips to keep your app secure and running smoothly

Let’s get your project online.

What is Laravel?

Laravel is a free tool that helps you build websites and apps using PHP. 

It takes care of many tasks that usually take a lot of time, like connecting to databases or handling user logins. 

This means you can focus on building your app instead of worrying about small details.

deploy laravel on shared hosting

Laravel uses a method called MVC to organize code:

  • Model – manages your data
  • View – controls what users see on the screen
  • Controller – handles the app’s logic

This structure keeps your code clean, easy to understand, and simple to update.

Laravel also comes with helpful tools:

  • Eloquent – makes database actions simple
  • Blade – helps you design pages quickly

Taylor Otwell, Laravel’s creator, designed it to remove the hard parts of web development. 

Many Nigerian developers love Laravel because it helps them build apps like online shops, school systems, or blogs quickly.

Important: Laravel needs PHP 8.2 or higher. Make sure your hosting plan supports it before you start.

What is Shared Hosting?

Shared hosting means your website shares a server with other websites. 

Think of it like renting a desk in a big office, you each have your own space, but everyone uses the same building and facilities.

With shared hosting, you get tools like cPanel to manage files, emails, and databases. 

The hosting company handles security, updates, and server maintenance, so you don’t have to worry about the technical side.

It’s also affordable. In Nigeria, shared hosting plans usually cost under ₦5,000 per month. 

Our hosting at Truehost works perfectly with Laravel and even supports easy local payments like bank transfers or cards.

Here’s a simple comparison:

TypeCost (₦/mo)Best For
Shared2,000–5,000Small sites
VPS10,000+Growing apps
Dedicated30,000+High traffic

Shared hosting does have limits. Since resources are shared, heavy traffic can slow your site. But for most small Laravel apps, it’s more than enough.

Why Use Shared Hosting for Laravel?

Many people think Laravel needs a powerful, expensive server. That’s not true. Shared hosting is enough for small apps or new projects.

Here’s why it works well:

  • Affordable: You don’t need a VPS. A simple ₦2,500/month plan can run many apps smoothly.
  • Easy to Use: You can upload and manage your site using cPanel without needing command-line skills.
  • Handles Small Traffic: If your site gets 1,000–5,000 visitors per month, shared hosting is enough.

The main limit is no full SSH access. But if you prepare your project on your computer first, this won’t be a problem.

Shared hosting gives you speed, savings, and simplicity, perfect for Nigerian freelancers, startups, and hobby projects.

Deploying Laravel on Shared Hosting

Getting your Laravel app live on shared hosting doesn’t have to be complicated. 

deploy laravel on shared hosting

If your project is ready, these steps take about 20–30 minutes. This guide assumes you’re using Laravel 12 and PHP 8.2+.

Before starting, test your app locally:

php artisan serve

If it works on your computer, you’re ready to move online.

1) Prepare and Compress Your Project

Open your Laravel project and make it ready for production. Run these commands:

php artisan config:cache

php artisan route:cache

php artisan view:cache

php artisan key:generate  (if you don’t have an app key)

Remove folders you don’t need on the server:

  • node_modules
  • .git
  • .env

Next, create a ZIP file of your project to make uploading faster:

zip -r my-laravel-app.zip . -x “node_modules/*” “.git/*” “.env”

2) Upload to cPanel

  1. Log in to cPanel, then File Manager, then to public_html, and to Upload.
  2. Choose your ZIP file.

For large files, you can use FTP like FileZilla. After uploading, the ZIP should appear inside public_html.

3) Extract and Set Up Folder Structure

Extract your ZIP outside public_html for security, for example:

/home/username/laravel-app

Inside, you should see:

  • app
  • public
  • storage
  • vendor
  • bootstrap

Now, link the public folder to public_html. This keeps your core files safe.

  • If symlinks are allowed: create a symlink from public_html → /laravel-app/public.
  • If not, copy the contents of public manually into public_html.

Set permissions:

  • Folders: 755
  • Files: 644

4) Configure index.php and Environment

Next, we need to make Laravel point to the right folders on your server.

Go to public_html/index.php (or your symlinked public folder) and update the paths for Laravel 10+:

require __DIR__.’/../laravel-app/vendor/autoload.php’;

$app = require_once __DIR__.’/../laravel-app/bootstrap/app.php’;

Replace ../laravel-app with the actual folder name you used on your server. This ensures Laravel can find its files.

Update the .env File

  1. Upload a copy of .env.example and rename it .env.
  2. Open it in File Manager and update:

APP_KEY=your-app-key

APP_ENV=production

APP_DEBUG=false

DB_CONNECTION=mysql

DB_HOST=localhost

DB_PORT=3306

DB_DATABASE=yourdb_laravel

DB_USERNAME=yourdb_user

DB_PASSWORD=yourstrongpass

If you don’t have SSH access, skip php artisan migrate for now. You can run migrations locally and import the SQL file into your hosting database.

Test Your Site

Visit your website URL.

  • See the Laravel welcome page? Your paths work.
  • Errors? Check logs in storage/logs for clues.

Updating index.php and .env correctly is key to a smooth Laravel deployment on shared hosting. 

Our Truehost plans make this setup straightforward.

5) Set Up the Database

Laravel needs a database to store information like users, products, or posts. 

Let’s set it up in cPanel.

  1. Create a Database and User
    • Go to cPanel → MySQL Databases
    • Create a new database
    • Create a new user with a strong password
    • Add the user to the database with full permissions
  2. Import Your Local Database
    • Export your local database via phpMyAdmin on your computer.
    • In cPanel, go to phpMyAdmin, select your new database, and import the SQL file.
  3. Update Your .env File

DB_CONNECTION=mysql

DB_HOST=localhost

DB_PORT=3306

DB_DATABASE=yourdb_laravel

DB_USERNAME=yourdb_user

DB_PASSWORD=yourstrongpass

  1. Run Migrations (Optional)
    • If you have SSH access, you can run:

php artisan migrate

  • If not, you already imported your database, so your app is ready.

Once the database is connected, your Laravel app can store and retrieve information smoothly.

6) Create a Symlink for the Storage Folder

Laravel stores user files, images, and cached data in the storage folder. You need to link it to your public folder so the app can access these files.

Option 1: If symlinks are allowed

  • Link /laravel-app/storage/app/public → /public_html/storage
  • This keeps files organized and secure.

Option 2: If symlinks are not allowed

  • Add this to your .htaccess in public_html:

RewriteRule ^storage/(.*)$ ../laravel-app/storage/app/public/$1 [L]

Set Permissions:

  • storage folder: 777
  • This prevents upload errors and allows your app to save files.

With the storage folder linked correctly, your users can upload images, files, and other data without issues.

Key Factors to Note When Deploying on Shared Hosting

deploy laravel on shared hosting

When deploying Laravel on shared hosting, a few things can make or break your setup. Keeping these in mind will save you time and headaches:

  1. PHP Version
    • Laravel 12 needs PHP 8.2 or higher.
    • You can check or change this in cPanel, then MultiPHP Manager.
  2. Performance
    • Enable OPcache in cPanel to make your pages load faster.
    • Caching routes, views, and configuration files also helps your site respond quickly.
  3. Security
    • Protect sensitive files like .env by blocking access:

<Files .env>

Deny from all

</Files>

  • Keep permissions correct (folders 755, files 644) to prevent unauthorized access.

By following these tips, your Laravel app will run smoothly, securely, and efficiently on shared hosting.

Common Issues and How to Fix Them

Even with careful setup, some problems can pop up when deploying Laravel on shared hosting. 

Here’s how to handle the most common ones:

ProblemCauseFix
500 ErrorWrong permissionsSet folders to 755 and files to 644
Missing routesNo .htaccessAdd the correct rewrite rules
Slow siteCache issuesClear cache (php artisan cache:clear)
Database errorsWrong .envCheck DB credentials and settings

Other Tips:

  • If your hosting doesn’t support Composer, install dependencies locally and upload the vendor folder.
  • If your site grows beyond 5,000 visits per month, consider upgrading to a VPS plan for better performance.

Handling these common issues keeps your Laravel app running smoothly and your visitors happy.

Conclusion

Now you know how to deploy Laravel on shared hosting step by step. You’ve learned how to:

  • Upload your files and set up your folders
  • Configure index.php and .env
  • Connect and import your database
  • Link the storage folder for user files
  • Fix common errors and improve performance

Your app is now live, ready for visitors, and secure.

Next steps:

  • Monitor your site regularly
  • Update your Laravel app often
  • Backup your files and database
  • Keep security in check

With these steps, even small projects and startups in Nigeria can run smoothly on shared hosting. 

Our Truehost hosting plans offer full support tailored for Laravel apps, making deployment stress-free.

FAQs

Can I deploy Laravel 12 on shared hosting?
Yes! Just make sure your hosting supports PHP 8.2+ and MySQL 5.7+.

How much does hosting cost in Nigeria?
Most shared hosting plans cost between ₦2,000 and ₦5,000 per month.

Why do I get a 500 error after uploading?
Check your folder and file permissions. Folders should be 755, files 644. Also, make sure .htaccess has the correct rewrite rules.

What if I don’t have SSH access?
No worries. Run migrations locally on your computer, export the SQL file, and import it into your hosting database.

Symlink is not working, what should I do?
Copy the contents of the public folder manually into public_html.

Is shared hosting good for an online shop?
Yes, for small shops it works well. Make sure you enable SSL for security, which is available on all our hosting plans.

Cheapest Domains in Nigeria

Get your .COM.NG domain now for just ₦5,500 (Back to 7K in 7 days)

.COM.NG for ₦5,500 | .COM for ₦12000: Coupon NEWCOM

Winny Mutua
Author

Winny Mutua

SEO Specialist Nairobi, Kenya

Winfred Mutua is a results-driven SEO Specialist with over 5 years of experience in technical SEO, keyword strategy, and organic growth. She helps tech and web hosting brands improve visibility, rankings, and conversions through in-depth keyword research, content optimization, and technical SEO.
Proficient in SEMrush, Ahrefs, Screaming Frog, Google Analytics, and Search Console.
What She Excels At

- Technical SEO audits & site optimization
- Keyword research and search intent analysis
- SEO content strategy & long-form content creation
- On-page optimization and WordPress management
- Performance tracking and data-driven growth

Currently an SEO Content Specialist at Truehost Cloud, driving organic growth for a tech/web hosting brand. She has also built and scaled two niche WordPress websites from scratch, achieving monetization through organic traffic.
Fully remote-ready and open to new SEO opportunities.

View All Posts