How To Deploy A Laravel Project On Linux Shared Hosting In 5 Minutes
Tags: laravel, php, linux, deploy
Published: 2020-01-13 23:18:17

---
title: How To Deploy A Laravel Project On Linux Shared Hosting In 5 Minutes
published: true
date: 2020-01-13 23:14:07 UTC
tags: laravel,php,linux,deploy
canonical_url: https://medium.com/@stephenjudeso/how-to-deploy-a-laravel-project-on-linux-shared-hosting-in-5-minutes-15280dafac22
---

![](https://cdn-images-1.medium.com/max/1024/1*ghPtx6kY9Ib4GRyhfN3nwQ.jpeg)<figcaption>Photo by <a href="https://unsplash.com/@chrisliverani?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Chris Liverani</a> on <a href="https://unsplash.com/s/photos/fast?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption>

In my [2019 review](http://stephenjude.tech/articles/a-recap-of-2019-code19) I mentioned that I was working on a side project which is setting up a [shared hosting platform](https://getlitehost.com/index.php) with [Laravel](https://laravel.com/)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](https://getlitehost.com/) 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.11).** Isn’t that amazing? [Litehost](https://getlitehost.com/register.php) is live and its 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.

Lets 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](https://github.com/stephenjude/stephenjude.tech/) on GitHub and its open source.

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

![](https://cdn-images-1.medium.com/max/723/0*iGusnaOrlbh7Zo6c.png)

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

```
cd public\_html

git clone [https://github.com/stephenjude/stephenjude.tech.git](https://github.com/stephenjude/stephenjude.tech.git) 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
```

Fine, now we have our Laravel project ready to be served but its 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.

```
chmod 777 storage
```

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

Finally you have to setup your ** .htaccess** file to point to your Laravel **public** folder. You can find this  **.htaccess** file inside the **public\_html** folder. if its 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.

### Conclusion

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](https://getlitehost.com/sharedhosting.php).

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](https://stephenjude.tech/newsletter) and never miss out on new tutorials, tips and more.

You can also follow me on twitter [@stephenjudeso](https://twitter.com/stephenjudeso)