Laravel 8 Installation - nGINX + PHP 7.4 + MySQL - Ubuntu 20.04 LTS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey youtube this is bharat i'm the founder and director of ready daddy's llc we are infrastructure as a service provider and a managed service provider as well and this technical video is about larger so larval as you know is the modern php framework that all the php developers are nowadays using and it has made life simple for developers to deploy applications more rapidly uh when compared to the past and php has now been gaining a lot of traction over the period of time so today we are going to see how to set it up on an input to 20.04 cloud instance from redundancy llc uh in our amsterdam infrastructure that we've been um deploying on a steady pace so let's get to it as you can see we are now on the larval's website and we have the basic documentation and all of the links present there i've gone ahead and deployed the new uh instance on our cloud infrastructure which is an ubuntu 220.04 instance now let's just start with updates okay i've run an apt-get update and what this command does is it searches all the repositories that are present for ubuntu registered within this particular cloud instance and it tries to update what all packages are available and are being sent from those repositories now we are going to check if we have any upgrades or anything that we need we can install so as you can see it says i do have a lot of remains to be done so i'll go ahead with installing them this might take some time uh initially you know so it downloads fast but it might take some time to complete the installation all our servers are powered by nvme drives so the actual read and write speeds are quite awesome you should be able to run any sort of application you know loads on our servers without compromising our performance as you can see we are now unpacking packages and setting them up so in the meanwhile laravel will need three different components uh actually four which is a web server a php processor a database and composer now for the web server we are going to use hdx which is a modern server and it is a lot better than apache which is the go-to standard web server in the operating system by default and then for php will be using php 7.4 with fpm and for my sequel instead of going with the tradition of my sequel we'll go with mariadb now mario db is uh like my sequel steroids so basically it performs better and is a lot more uh robust when company compared to the basic my sequel so you can consider using it there is no literally no difference in these schema capabilities although mario db is a pitch tricked with the data types you can disable straight mode in the configuration file so for composer we'll go with whatever is available you know on their website and now since the setup is almost done it's currently processing triggers and once the triggers are processed you know figures are like these post installation steps that need to be run once the package is installed so let's try to do that okay so we are done with the updates now let's go ahead with installing our first component which is nginx so i'll do i have to install engine x and press y okay there is our nginx and now we will just enable engine x using the system cto command and then we will start it and then we'll say status engine x yeah as you can see engine x is currently running yeah so to test this out what we'll do is we'll visit the browser and you can see that engine x is you know running and responding to the public board by default we might list all the ports in our cloud instances except for 25 uh which is a mailing port but it can be requested for white list once you know you're done you have a valid reason for the same okay so synx is installed next comes the php uh installation for this we are going to use the php uh the ppa entree repository for this instead of the uh ubuntu repositories because uh it sometimes has holder packages so let's add that repository um apt add repository ppa entry or slash php iphone y now iphone why it says that uh you shouldn't ask me whether it's a yes or no it's definitely a yes and you can go ahead but let me just show you and there it is uh it will you know to have to update as soon as the package uh i mean the repository is added into our list source list so that's done now i'm just saying i have to install php 7.4 and yeah it's going to install php 7.4 with all the default packages but then we'll also be setting up additional packages for uh laravel to perform you know larval always depends on such things now you can notice one thing this here has tried to install apache on ubuntu though we are using nginx but that's because we didn't specify any specific packages for 7.4 to be installed so it will by default install apache so let's just remove that after you know about g2 and then once upon c2 is removed you will do an app or to remove and this will remove any packages that are no longer required by the pc or the system uh that's done uh let's install packages that would be used required for reliable to run so php 7.4 now we can do it like this php 7.4 iphone any package name you give but this is going to become quite lengthy so what we are going to do in a shortcut method is we are going to open a curly brace and then we are going to close it and then in between we are going to mention the packages so cli td perl mysql ldap sip file info fbn xml mv string exif so image xml okay xml is already here in the chip be a spell and i think that should and as you can see it's now adding all those modules to modules or extensions to the php installation we also need to install psp um i think and there's one more thing called mb string yeah that's all i've done okay so that's about it uh don't worry about the commands they'll surely be listed in the description below so php has been installed now we are going to do a system ctl enable php 7.4 fpm we have to mention the version yes since ubuntu allows you to install multiple php versions uh on the same system and then we are going to say start php 7.4 fpm okay and then you can check the status here as well and it's running okay and now we need the mysql right so apt install mariadb just say yes so this will install my sequel with mariotti and you know it will be a default of my sequel 1.7 so my db is on a version scale of 10 point xx whereas my sequel is on 5.7 or 5.6 and recently the mysql 8 has come out but yeah our installation was done system cto enable maya tv system cdl start miner db okay once that's done we're going to say mysql install secure installation uh we haven't provided any password yet so we'll be creating a new password as i always use password generated.net for generating passwords now we'll be using removing anonymous users and we'll also disable root login remotely we'll remove the test database and reload this now if that's done you have a secure mysql installation as of now and just by typing my sql you should be able to go in yeah and you're on mario tv 10.3 yeah okay now what we are going to do is we will exit this our next and final component is installing a composer um and you know composer is the vendor package manager for php it is like npm for node.js so let's start with that we are going to just copy the commands listed on their website to download the setup file so phpfr it copies the installer and names it as composer setup what you can do is you can just copy this link okay and then you can say uh double get this iphone o composer iphone setup.php and then you can just run php composer setup php install tier is equal to user beta and then file name would be composer yeah once that's done you should be able to yeah yeah so you are now having composer here yeah so let's go to uh www html here you can see two files index.html index uh nginx html i'll be removing both of them and then i'll just say compulsor v8 project it will install all the packages within that directory yes and now we just have to wait for composer to do everything for us that's it and uh we now have the entire liberal directory structure now if i still try visiting that page okay it says 404b now this is quite common because we don't have an index file over here it's pointing directly to this directory so let's go to our text configure make some changes to go to the nginx configuration you can visit etc here you can see a lot of files just open the enginex.com and you need to know two things one is the user over here okay we need to make sure that the user wwe data is also being used by php fpm as well okay uh the next thing is you can notice that virtual host configs are located in here and here we will use this for our website configs okay so edc engineering site setting let's go to edc internet a default file open it i'll remove all these commands i'll remove these commands as i'll well this as well this i'll explain what is what shortly now if you are using php we need to add index.php to the list so let's add it to the first what this does is in any directory that the user tries to visit from the web server or maybe from the browser it will look for an index file which would be one of the following the index.php the index.html or html or this file if it doesn't find any of such files it just says 404 bit and it's not going to list the directory for you yeah that is a security part now the next thing you see here is this so fast cgi which is all the php requests will be processed by this file this socket we need to make sure that the socket actually exists so let's check yeah it exists that's why it's returned here anything so if it doesn't exist let's say i'll just change it to one it will say no such file or directory okay now it takes us now you need to check which user the php fbm processor is running out so psr grab php it's running as the wwe data user so that's fine will not have issues between nginx and php however in the html directory the html directory is over by root you know it's not going to allow it to write anything to it so we'll just say www data html iphone r and what this does is it will you know change the ownership of the html directory to ww data yeah as you can see and now we need to give we need to tell nginx that larval has the index file in public directory so we need to only expose this directory from engineering to the world so we'll go back to nginx sites enabled default and we'll say that root should be public save it engine x iphone d this checks the configuration file for any mistakes make sure to do this always so you'll be in safe hands nginx iphone s reload this will not restart up nginx but it will slowly kill and recreate each and every worker that is online okay now that's done now let's go back to that website and let's see yep laravel is finally here so this is this uh now let's test our connection to the database so first things first let's open the env file and here you can see the database name is laravel username is rooted and password is nothing let's try making this label as well and the password can be set to wait um welcome one to three this is just for example purposes never use such passwords save now we will go to my sequel we'll just say create user in inverted us larval atherate local coast now localhost because laravel only should be able to access it through localhost and nowhere else so identified by one second left and capitalize that identity five right by uh welcome one two three oh sorry identified by one two three and then um create database laravel and then grant all privileges on laravel dot star that is the database name and star dot star means any tables on it to larval at localhost okay and then we'll just say flush previous okay that's done let's fix it now we just try our migrations default migrations php rtc migrate oh sorry migrate and that's it as you can see it was able to successfully connect to the database that's the reason it was able to push all those tables now i'll just say my sequel use laravel and show me the tables of show tables and that's it we now have all the tables here i hope this was educational i hope this was helpful so if you have any doubts uh regarding this setup you can comment and ask us and we'll get back to you as soon as possible if you like the content please like subscribe and share our channel and support us and we'll come up with more great videos and tutorials moving forward thank you bye
Info
Channel: ReadyDedis LLC
Views: 546
Rating: undefined out of 5
Keywords: laravel, ubuntu, 20.04, cloud, install, installation, linux, nginx, php-fpm, mariadb, mysql
Id: Ne08lkfXUu4
Channel Id: undefined
Length: 21min 2sec (1262 seconds)
Published: Tue Oct 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.