Developing laravel in local environment or localhost is so smooth that we always ignore how does actually laravel is deployed on live server. There is a wrong notion spread across developer community that, Laravel needs AWS or VPS server otherwise there is no need to code in laravel. They are right but to some extent only because laravel framework is developed on PHP and PHP needs server to execute scripts written. Therefore server can be anything; it may be AWS, Digital Oceans VPS or simply bigrock or godaddy’s shared hosting server.
Today, in this post I am going to show you how to deploy a laravel project from git repository to your shared linux hosting server in simple and easy steps.
Today, in this post I am going to show you how to deploy a laravel project from git repository to your shared
linux hosting server in simple and easy steps.
FYI, I am using bigrocks’s single domain shared hosting server where my blog is hosted basically. So let’s move
step by step.
Table of Contents
● Open Terminal
● Clone git repository outside the public_html directory
● Run composer install
● Move contents of public directory to public_html and delete public directory from project
● Edit index.php in public_html and set its permission as 644
● Create MySQL database and Database User
● 7. Rename .env.example in project directory to .env and edit mysql data values as shown in step 6
● Run php artisan migrate:fresh –seed
● Create Storage directory symlink
● Give permission to storage and bootstrap directories
● Run php artisan config:clear, php artisan key:generate and composer dump-autoload
Every shared hosting comes with a cpanel that is it the central control panel where you modify settings as the
permissions give to you. Search for terminal in search box and go to the terminal.
Clone git repository outside the public_html directory
If you have been following my blog then you may remember that we had developed a
​simple crud application in
​ I had created a repository on GitHub hence we will use that repository.Go to
​Simple CRUD Repository
and clone it
​outside the public_html directory
​ of your server.
As you can see our repository simple-crud is placed just outside the public_html, lets move to step 3
Run composer install
By default vendor folder is not included in laravel package we need to run
Now laravel and its
​ are installed via composer.
Move contents of public directory to public_html and delete public
directory from project
As my blog is hosted here hence I have created a subdirectory called simple-crud where I am going to move my
repo’s public directory’s contents a