How to deploy your Laravel apps to shared web hosting

In this article, I’m going to show you how you can quickly deploy your laravel app to a shared web hosting.

The basic trick is to rename the public folder on your laravel app to the web root folder on your live server (this is usually www or public_html).

You can now zip your laravel app and upload to your live server but this time you unzip it in your home folder and not the web root folder. Enter the url of your website on a browser and you should see your app running.

NOTE: When zipping your app folder, make sure to include the vendor folder too. You can skip the vendor folder if composer is installed on your live server so you can just run commands like composer install and composer dump-autoload

One issue with this approach is that the home folder can look messy as shown in the image below.

Another issue is that you will not be able to run the command php artisan serve on your local machine but you can get away with this by starting your own php server with this command php -S localhost:8000 -t public_htmlor just using a virtual host.

Thats it. Let me know what you think of this approach

Leave A Comment

Your email address will not be published. Required fields are marked *