Deploy Laravel 8 on Godaddy
In this article, I will show you how we can deploy Laravel 8 on GoDaddy, I will use GoDaddy for that. Believe me, deploying Laravel 8 on GoDaddy is child work, Deployment takes approx 5 to 10 minutes.
To deploy Laravel 8 on Godaddy we will follow the below steps -:
- Creating an account on GoDaddy
- Install Laravel application
- Upload on GoDaddy and unzip folder there
- Install NVM on your Laravel project
STEP -1 : Create an account on GoDaddy
To create your GoDaddy account visit https://www.godaddy.com/ after that you can see the registration page something like below
STEP-2: Download the Laravel Application
Open your command prompt under your htdocs and run the below command
composer create-project laravel/laravel laravel-demo-project
STEP-3: Upload project on Godaddy
Log in to your account and click on visit my account
Now go to file manager click on file manager and then go to your public_html folder, put your zipped there under the public_html folder
Now here extract all your files to the public_html, after that you have to go to Laravel public folder and move all those things to the public_html folder on your GoDaddy Shared Hosting.
Now look for index.php file
Open that file and go to line number 34 you have code like below
require __DIR__.'/../vendor/autoload.php';
change to the below one
require DIR.'/vendor/autoload.php';
then go to line number 47 you have code like the below one
$app = require_once __DIR__.'/../bootstrap/app.php';
change to the below one
$app = require_once DIR.'/bootstrap/app.php';
If you want to use NPM, then you have to install NVM, yes it is NVM not NPM, follow the below step to achieve that thing.
Login to your SSH and type this command :
wget -qO- https://cdn.rawgit.com/creationix/nvm/master/install.sh | bash
run this command in order to be able to use it :
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
After that you can install node :
nvm install node
That’s it, I hope you enjoy this article still your laravel project is not working, please comment will reply to you asap.
Thanks for sharing the steps to install laravel on GoDaddy.
I have multiple websites under the public_html folder so I extracted the zip file to a subfolder of public_html.
I edited the index.php file with following:
DIR.’/subfoldername/vendor/autoupload.php’
DIR.’/subfoldername/bootstrap/app.php’
Now that I am trying to access the webpage with the domainname/subfolder/ I get the following exception:
ForbiddenYou don’t have permission to access this resource.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Any recommendations?
You have to move all your public folder data to your root path. for example if your project is under public_html/lara-project/ and your public folder is under lara-project, then move all your public folder data to lara-project folder. I hope you understood.