How To Deploy A Laravel Project On Linux Shared Hosting In 5 Minutes

Published January 13, 2020 • 3 mins read

In my 2019 review, I mentioned that I was working on a side project which is setting up a shared hosting platform with Laravel developers in mind.

I have deployed lots of Laravel projects on Linux shared hosting and I know how painful it is especially when there is no ssh access.

Litehost is here to solve that problem. It has ssh access on all its hosting plans and it has Composer, Git & PHP CLI pre-installed on its servers. Finally it pretty affordable, just ₦400/month ($1.). Isn't that amazing? Litehost is live and we been accepting customer since 24th December 2019.

Just yesterday I moved my blog which I built with Laravel to Litehost server. So I am going to show you how I did it in 5 minutes.

Let's get to the main thing. I will assume you have already a CPanel account with ssh access on it.

Project Setup

Push your Laravel project to a remote git repository. I already have my blog's repository on GitHub and its open source.

Now, let's go back to our CPanel. If you have ssh access on your hosting plan, look for the terminal under the advanced tab and click on it.

Move into your public directory and pull your Laravel project from your remote repository.

cd public_html
git clone blog

With this command, you now have your project inside public_html/blog  folder.

Make a copy of your .env.example file and update your .env variables. You can do this using the CPanel file manager. Remember that Show Hidden Files (dotfiles) must be enabled from the CPanel file manager settings.

Now enter into the project folder and pull all the required dependencies.

cd blog
composer install

Now we have our Laravel project ready to be served but it's remaining one more thing. Laravel makes use of the storage folder for lots of things like writing logs, caching views and local file storage for uploads. Let's make that folder writable.

 chmod 777 storage

I know this is not advisable but we are not on a VPS. We are on a shared server with some limits to what we can do. Yeah.

Finally, you have to set up your .htaccess file to point to your Laravel public folder. You can find this .htaccess file inside the public_html folder. If it's not there then create one and update it with the code below.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^blog/public
RewriteRule ^(.*)$ /blog/public/$1 [L]

That's it, you have successfully deployed your Laravel project.


I know this not the best way to deploy a Laravel project but I believe it's efficient enough to get your project up and running on a Linux shared hosting.

I am still working on setting up shared hosting plans tailored for Laravel developers. The idea is to save time and deploy faster on shared hosting.

Join my weekly newsletter and never miss out on new tutorials, tips and more.

You can also follow me on twitter @stephenjudeso

Hey, have you tried Litehost lately?

Litehost is my side project which is a shared hosting platform with PHP & Laravel developers in mind. It has Composer, Git & PHP CLI pre-installed on its servers. SSH access is also granted on request. Litehost is pretty affordable. Try it today.