Wednesday, 29 April 2020

How to Upload a Laravel App on Shared Hosting Server like GoDaddy


Laravel is a PHP framework that’s an excellent option for website development. The simple syntax is elegant and expressive, which makes the development process more rewarding and creative. For developers of PHP, Laravel development has been hailed as the best for bringing out an element of joy.

The framework definitely is worth learning. Its usage curve continues to go up and there’s a great chance that it would be used more this year than in previous years. There are many reasons for the growth of Laravel development, in particular the security, ease of use, and scalability it brings.

Furthermore, a Laravel app could be deployed on a shared hosting server such as GoDaddy. GoDaddy is a publicly-traded domain registrar and a web hosting company as well. It approximately has more than 18 million customers and over 9,000 staff all over the world, including the UK. It’s renowned for advertising in newspapers and TV.

If you want to upload a Laravel app to GoDaddy, here are some requirements:

     -  GoDaddy shared hosting account
     -  Amazing Laravel project to be deployed
     -  SSH access

THE STEPS


The first thing you have to do is to select a domain name and choose a hosting plan. You could choose the first option.




After making your purchase, you now have access to your Cpanel. The first thing that you should do is to enable SSH. To be able to do that, go to your products and then click Manage on.




You would then be redirected to your Cpanel page. At the bottom right you could enable your SSH.




For you to connect to SSH, you would need these: Host, username, and password. If you’re using Windows, it would be easy to connect with Putty. On Linux, you could utilize your Terminal by typing:


It would then ask for a password, that’s the same with your Cpanel.

Laravel Deployment


Login to your SSH account and Install composer with these 4 commands




In order to verify that the Composer is already installed on your server, you could check the version:



You can now make a fresh Laravel installation with the use of Composer:





If you have developed your app on local already, consider zipping your files and then uploading them to your Cpanel with FTP or the uploader via the file manager. How to do it? Make a new folder in your public_html, then rename it, for instance: blog


You can then upload your zip, then extract all of your files.


You must now move the public folder into public_html



Now, we have to go to our folder public and then edit the index.php



You must edit line 22 and 36 by adding the path name that we already have created, in this case, it’s blogf, on the top of the article I stated: blog. Furthermore, the folder was renamed to blogf since there is a route in a Laravel project that has a similar name, thus you must take this case into account. Now, if you visit your link, you would be facing HTTP Error 403—Forbidden. So, how do you fix this?

Simply make a .htaccess file in the public_html, then pass this:


In the .htaccess, you have to change blog if you are using a different folder name. You can visit your application now. For the database:

     1.  Update the .env file.
     2.  Build a database and a user (Link them).
     3.  Run the PHP artisan migrate, which is working on GoDaddy now.

If you should wish to install node in your server, you can use nvm.

Login to your SSH then type the following command:


The command should be run in order, to be able to use it:


You could then install node after:



Author Bio:


Shira Gray is working as a Business Development Executive at Laravel Development Company – eTatvaSoft. She writes about emerging technologies and you can visit our blog to know more about her writings. Being a tech geek, she keeps a close watch over the industry focusing on the latest technology news and gadgets.


0 comments:

Post a comment