How to Deploy Laravel on Shared Hosting in 12 minutes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you probably know how to create basic collateral applications but do you know how to deploy it in a production environment with a custom domain this is exactly what I'm going to show you in this video we're going to get the hosting connect to the hosting server using SSH clone and existing lateral project create mySQL database and configure it run all the necessary commands we need and finally we're going to make laravel example application up and running on a custom domain with SSO certificate thank you foreign my name is Ura and I am the co-talk on this channel I share my 10 plus years of experience working as a professional software developer so if you're new here consider subscribing previously I have used many different types of Hosting Services shared hosting EPS hosting Cloud hosting all of them have their advantages but disadvantages as well on VPS you get all the control you need on your servers but it's a little bit expensive and you have to do a lot of work you have to set up your server PHP version MySQL and everything you might need Cloud hosting is excellent for large projects it costs much more than shared hosting but you get also more CPU and RAM and more server resources shared hosting in my opinion is the perfect one for small and medium sized projects well I'm using shared hosting for like past two years and I didn't have any problem on my website so far so if you are not doing something which should serve thousands of people premium shared hosting will probably be enough for you my Preferred Choice of Hosting provider is hostinger let's go to the website hostinger.com thecodeholic so we immediately see the deal which is only for Black Friday let's click claim deal and let's have a very quick look what we're gonna get in this uh price so we have possibility to deploy up to 100 websites we get 100 gigabyte of SSD storage we get free email unlimited databases and bandwidth we get unlimited SSL down below we have the free domain which by itself calls costs 10 and that is included for the first year down below we have 99.9 percent uptime and if you are not happy with your services you can get your money back in 30 days I think it definitely worth to try okay let's click add to cart so here we have possibility to choose one month 12 24 or 48 months the longer period you choose more saving you are making and let's scroll down below you have to sign up with your email or Facebook or Google and down below right here make sure you provide the coupon code the code holic let's click apply and it's going to give you additional 10 discount and pay attention if you purchase this for four years you are making insane amount of discount however the domain is included for the first year only so then you provide your credit card information click the submit secure payment and then we'll be redirected to the hpanel and I'm going to meet you right there once you register at hostinger and login you will see the following page now we have to set up our premium shared hosting let's click Start now I'm going to skip this section I'm going to skip this one because I'm going to create an empty website now we're going to claim our free domain so I'm going to click right here and we have to provide the domain name I'm going to type laravel example and choose.com let's click search that's a perfect domain and it's available let's click continue here we can choose the server location and we have several options you should probably choose a location which is close to you or close to potential visitors of your website I'm going to click finish setup at this stage we have to provide a profile for our domain I'm going to use my existing profile if you're new to hostinger you should probably click add new profile and fill up the information I'm going to click finish registration it will take a minute to set up the SSL and domain and now we have the website ready let's open new tab and type laravel example.com this is the default template for every new website on premium shared hosting pay attention that we don't have SSL certificate yet we have to install SSL certificate which is as easy as just clicking few buttons under control panel let's click manage site this will open Age panel for our website from here we have possibility to create business email address go to the domains and create subdomain under files we have possibility to access to the file manager or FTP accounts we can create MySQL databases and under Advanced we have possibility to configure DNS or PHP or set up Chrome jobs we even have access using SSH and git and finally SSL let's click on the SSL as we see at the moment the status of the SSL is failed let's scroll on the right side click on this three Dot and click reinstall after few seconds just reload the page and you're going to see status active and if we go on our website and reload we're going to see larval example.com under SSL now let's install lateral application before we install anything let's go under Advanced and PHP configuration from here we can change the PHP version manage our PHP extensions or configure a couple of PHP options at the moment I'm going to switch to the latest PHP version 8.1 and hit update now since we have the latest PHP version we can already create lateral project let's go in the hostinger age panel go under Advanced and click SSH access by default SSH access is blocked so we have to click enable right here we can log into SSH with two methods using password or public private keys if you already have public key just click the button right here provide your SSH public key give it a name and click add for Simplicity in this video I'm going to log in with the password first of all let's change the password make sure your password is something very unique and secure if you have any terminal that supports SSH copy the following command and run in your terminal if you don't have a terminal which supports SSH I recommend to download Puti which is a very good SSH client inside putty right here we have to provide IP address we have to provide port and let's just click open on the very first connection it's going to give us this security alert you have to accept this then putty will ask what is the login inside login we have to provide username inside the password we have to provide our password now we are on our hosting server let's have a look at the files in the folders right here we have public HTML folder which is a symbolic link on domains laravel example.com public HTML folder and the default content what we see in the browser when we type lateralexample.com is coming from this public HTML basically I'm going to remove this public HTML now we don't have this anymore I'm going to navigate under domains and here we have laravel example.com I'm going to completely delete laravel example.com folder and create new one which is going to be lateral project as soon as I delete this and check in the browser we will see our website is now broken now let's go in the terminal and create new laravel project using composer let's type composer dash dash version at the moment while I'm recording this hostinger premium shared hosting servers support composer version 1. It's recommended to switch to version 2 for laravel projects so I'm going to install a local composer which will be version 2. in the Google let's just type composer version 2. and click on the link to download composer latest let's copy the following fragment go in our terminal and paste let's hit the enter now let's clear up everything and have a look here we have composer far which now is composer version 2. so in fact if I execute PHP composer for test Dash version that's going to give me version 2. if you want to create a fresh new lateral project run PHP composer for create project laravel laravel space and laravel example.com make sure right here you give the exact same name folder name whatever you gave to your domain this will create a very latest laravel application but in most cases we already have ready project and we want to clone that project right here here I have a brand new laravel project I'm going to click code go to the https and copy the following URL then go in my terminal and run it clone paste the following URL then space and I'm going to specify again the exact same folder name whatever I gave to the domain laravel Dash example.com let's hit the enter now I want to navigate inside the project and run composer install however every time I run composer it's going to give me the version one I don't want to use version one so every time I will need composer I'm going to run a PHP composer far and then the composer command I have the composer file right here in this domains folder in the domains folder is under my home folder to make the composer far easily accessible from anywhere I'm going to move it in my home folder move composer far under my home folder slash hit the enter now I don't have composer file right here however if I navigate into my home folder I have composer far right here now let's navigate under domains under my project and we're going to run composer install PHP my home folder slash composer for install hit the enter after composer install there are two things to do first we have to create.in file and I'm going to copy an existing in example into dot en if I type ls.la I will see dot en file right here next is to generate key we're going to run PHP Artisan e colon generate HD a and Si hit the enter and application key set successfully if your application uses storage then you might need to run PHP Artisan storage column link which will create a symbolic link inside public storage folder now let's clear up everything and the list files and folders We have almost everything ready the most important thing is to create public HTML symbolic link which will be linked to the public folder let's run ln-s a winter map public folder into public underscore HTML the public HTML folder is looked by hostinger so it must exist I'm going to hit the enter and let's again type ls-la to have a look and we have public HTML now if we check our domain we're going to see lateral application up and running now let's create database and run migrations let's go in the age panel and search for database click on MySQL databases let's specify right here database name username and some secure password and click create the database was successfully created and we can see it right here from here we can click to enter into phpmyadmin and create some tables whatever we want but in this case we're going to run migrations so I'm going to go in the terminal and open.en file I'm going to use veeam for this veeam.en let's type I to go in the insert mode and let's change database which is going to be my database name let's specify username in my password word I gave when I was creating the database now I'm going to hit Escape colon W and Q to write and quit from this and now I can already run migrations by running PHP Artisan migrate if you see successful message that every migration was successfully created congratulations your connection to the database was successfully made on our website if we just reload nothing really changes because our homepage doesn't use connection to the database but you know that you have access to the database not you but your website has access to the database alright guys that's it for this video and I hope you like it make sure you check the link hostinger.com and if you decide to get the premium shared hosting use the coupon code the code holy as well which will give you additional 10 discount if the video is helpful make sure you hit the like button and help the channel to grow alright thanks for watching and I will see you in the next time
Info
Channel: The Codeholic
Views: 46,155
Rating: undefined out of 5
Keywords: TheCodeholic, php, learn php, php tutorial, laravel tutorial, deploy laravel, deploy laravel project, laravel project, laravel hosting, cheap php hosting, cheap laravel hosting, cheap hosting, affordable hosting, laravel hosting on custom domain, php custom domain hosting, hostinger, hostinger premium shared hosting, Deploy laravel project, deploy laravel project on shared hosting, laravel shared hosting deployment, laravel shared hosting
Id: dpJDV25tptw
Channel Id: undefined
Length: 12min 55sec (775 seconds)
Published: Fri Nov 25 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.