Laravel 5.8 – From The Ground Up - Laravel 5.8 Tutorial From Scratch – e33 – Deployment: Basic Server Setup – SSL, HTTPS – Part 3

Education, Programming

Laravel 5.8 – From The Ground Up

52 Lessons

Laravel 5.8 Tutorial From Scratch – e33 – Deployment: Basic Server Setup – SSL, HTTPS – Part 3

welcome to part three so we are on the third section of this step-by-step guide in deploying and layer of application from scratch if you missed the first two

parts make sure you catch those before you move on to step three as we are getting into more advanced SSL Certificates in this one and some extra credit stuff that we want to do for our

prompt so in our previous episode we were able to load our project inside our droplet so up next I want to set up let's encrypt and what let's encrypt will let us do is have an SSL

certificate so we can serve over a secure network as opposed to just a regular HTTP non secure domain so in order for you to actually get let's encrypt you do have to have a domain

name so that is a requirement for being able to get an SSL certificate we can no longer rely on our IP so I have my domains set up in digital ocean so I'll actually add a subdomain and be able to

have a domain for this demonstration so let me take care of that now in digital ocean you go to the networking tab down here and then to my coders tape domain I can add an a record and the a record is

gonna be just level and you see here you get a preview that's gonna be layer vocoders tape comm and our resource is gonna be that first project droplet that we've been working on so let me create

that record now and we are good to go so if everything worked we can visit larva dot coders tape comm and get the exact same project so we do have a domain setup for our project now it's as simple

as that now digitalocean makes this extremely simple so that is one nice thing with digital ocean you saw we added that and immediately we were able to use it right

away great so let's move on so let me add the cert bot cert bot is a program that will actually allow us to get the certification for our project so the first thing you need to do is add the

repository and then we can actually get cert bot working so let's give that a minute and we'll be right back and there we go let's move on to step 2 so

now we're gonna install the actual cert bot for nginx hit paste yes we do want to install let's give that a minute we'll be right back great let's move on to the next step so this next one I'm

gonna copy the command and we do need to modify it a little bit I'll clear the terminal so it's nice and clean so the first thing you see here is we have this – D and then another – D WWD

example comm so this would be obviously in the case where you have aaww and a non wwm a name in my case I am actually in a subdomain so I just need the one and mine is levo dot coders tape com

perfect so now the other thing we have to change is obviously our web route path it is var dub dub dub HTML and then first project slash public and that's it so this is our final command here sudo

cert bot and then the web root path is VAR dub dub dub HTML then whatever you name your project slash public and our domain name like I said is required Larry vocoders tape comm this is my

particular one obviously made the correct modifications for your system I'll hit OK and email address is required all right so let me give it an email address

Victor head coders tape comm do you agree of course you have to say a to agree would you be willing to share your email address and typically say no and now we're obtaining a new certificate

and we're waiting for it to get certified and there we are it's as easy as that so now our certificate is in our droplet now take a look at this right here this is obviously where your

participants got put it's nice that it outputs where it is because we will need that in just a couple of minutes alright so how do we actually use it so to use it we actually have to modify our and

your necks so up until this point we've been using port 80 how ever SSL HTTPS requests are actually on port 443 so we're going to modify our nginx configuration to this one and this

is the production ready nginx configuration that we've been working towards in all of the previous lessons so let's run through it really quickly so the first thing is we're still gonna

be listening at port 80 but the reason why we're gonna be listening in port 80 is because we actually want to do a 301 redirect which is a permanent redirect to exactly the same thing that came in

but using HTTPS so this is the step that if any requests comes in to a server requesting a non secure URL we simply switch that over to an HTTPS URL that way we are serving it over our secure

SSL and not through regular unsecure so then we're gonna create another server this time we're gonna be listening over 443 SSL HTTP – we will have to put our domain name in server name and of course

we'll have to change this first project now here's that SSL certificate that we just generated notice that the address here is etcetera let's encrypt live and then the domain name so the same thing

here it will need to be modified to whatever your domain name is we'll take care of that in just a second and then everything else remains the same we're still fetching PHP we're still rejecting

all htaccess files and this dot well known we're gonna allow that is actually for our SSL Certificates to be able to get renewed that's more of an advanced topic but I will copy this entire block

right here and for the final time let's go into our sites available and modify our nginx configuration so that would be sudo vim etc nginx sites available and then levo that coders tape comm and

let's delete everything inside this file now and let's paste in that entire block from the guide all right so what do we have to change here well the first thing we need to change is we need to make

sure that the SSL certificates are in the correct place notice this placeholder right here and this placeholder right here we need to change both of those so let's do that

now laravel dot coders tape dot-com and then same thing in this other placeholder that's laravel dot coders tape dot-com what else do we need to change if you

did not use first test project you do need to change that here and up until this point we've been using server name we've been using the IP but since I actually set up a proper domain name I'm

gonna use that now so laravel dot coders tape dot-com and let's change it over here one more time laravel coders tape com alright so we are good to go so this is

our final nginx configuration file again we are setting up two servers one it's going to be unsecured and one is going to be secure this one just simply redirects to our secure server so that's

it this is good to go I'm gonna hit escape : WQ to save and exit and let's move on to the next step so now we can run that test one more time just to make sure that everything

is running good and we get ok and successful perfect so now we need to modify our firewall up until this point we've been serving HTTP requests but we need to be able to serve HTTP requests

as well not just HTTP so we can allow that by simply running sudo UFW allow nginx HTTP alright so now that rule was added again you can run the status command just to verify that the changes

took effect and sure enough we are serving OpenSSH HTTP and HTTPS requests and finally let's do an engine X reload hit paste and we're good to go so now let's test it out in the browser

notice that I'm not secure right now I'm gonna hit refresh and with any luck we'll be in HTTP refresh and we're good to go notice the little lock right here so we

are serving this site has a secure connection perfect so we are good to go at this point you can quit everything is set up in our server but if you stick

around for a couple of more minutes I do want to do some modifications to my prop just to make it look a little bit better you're gonna spend a lot of time in the server and sometimes it's just nice to

see something nice instead of just your plain text so we're just gonna follow all of this so the first thing we're gonna do is install c shell c shell is very similar to show except that it's

got some extra sugar on it that i think you're gonna like and if you really get into this stuff you're gonna see that over time you're gonna need a little bit more power with your terminal so let's

copy that command and run that now paste will say yes to install that all right now if you run this command we can confirm that everything was installed and sure enough we have C shell five

point five point one now we need to find out where C shell is because we need to make that default so if we run this command we see that it's under user bin C shell okay so now let's go ahead and

modify that as the default so now we actually need to reboot our entire droplet just to take that effect so it will log me out I'll wait a couple of seconds and then log back in all right

let's try it again and we're in so the first time that you run C shell it will actually run a quick setup for you so if you did everything right with the installation this is the screen that you

get the next time that you log in so we just want to populate a standard sea shell our C file so I'll go ahead and click – and we are good to go so you notice that right away

our prompt looks a little different now let's install power line in the font power line again all of this is just to make our prompt a little prettier so we'll install a nice

font looks like I mistyped my password there we go well hit yes all right and now let's install the power level 9k theme this is one of my favorite themes so I'm gonna let you in on a secret I

think you're gonna really like this power level 9k so now we need to enable it so to enable it we're gonna echo the theme into our seashell RC file let's do that now and

then we need to exit and we need to connect back in and there we go we have a really nice prop now and if you CD into a directory for example now you have a nice path of exactly where you

are you also get this other stuff over here which will actually interact with git and all that stuff and if you've been following along with the series from the very beginning this probably

looks familiar to you this is the theme that I use every single day so this is how you install that you can install this in your local machine as well not just in your server alright so one final

thing I want to do is just install oh my seashell this is just another powerful utility that you can install and if you do some research you'll see that all my seashell actually has some really

powerful get integration so this is really cool so the final step is we actually do need to re-enable our theme so let me copy that paste that in and then let me exit out and log back in and

there we are so that is it for the bit of extra credit if you've made it this far congratulations you now have a fully deployed level application with everything needed to get started with

your project if you have any questions drop a line in the comments and I'll try to answer those for you as always thanks for following along don't forget to subscribe and we do have

a little bit more in this series so when you're ready let's move on to the next episode

In part 3, we are tackling getting an SSL certificate from Let’s Encrypt and some extra credit prompt setup. The time has come for us to start setting up our own deployment server with everything we need to start hosting our project. Follow along as we set everything up from SSH, Nginx, PHP, MySQL and everything in between.

For the best experience, follow along in our interactive school at

DigitalOcean Referral

Full Deployment Guide:

Course Source Code

Hit us up on Twitter with any questions or comments @codertape (

About This Course

Ready to get started on your path to Laravel Artisan? In this series, we are breaking down all of the basics of Laravel to get you comfortable using the world’s most popular PHP framework. Let’s get started!

    add to database laravel admin laravel artisan Artisan Command artisan commend create artisan console artisan laravel command authentication in laravel belongsto belongsto laravel example coding tutorials create artisan command create command artisan create new command artisan Create your own crud laravel crud laravel tutorial crud resource laravel crud with file upload custom artisan commands custom artisan commands laravel custom laravel database configuration laravel database relationship digital ocean dotenv eager loading eager loading in laravel eager loading vs lazy loading laravel eloquent eloquent accessors eloquent mutators eloquent orm feature testing laravel fetching data in laravel filesystem laravel form requests full stack vue gate and policy laravel google optimize hasmany hasmany laravel hasmany laravel example hasmany relationship in laravel hasone hasone relationship in laravel How to create how to queue email how to use queue installing laravel intervention image laravel laravel 5 laravel 5 auth laravel 5.4 queue laravel 5.5 queue laravel 5.8 laravel 5.8 artisan command laravel 5.8 artisan console laravel 5.8 auth tutorial laravel 5.8 authentication laravel 5.8 commands laravel 5.8 crud laravel 5.8 crud example laravel 5.8 custom middleware laravel 5.8 deprecations laravel 5.8 eager loading laravel 5.8 elixir laravel 5.8 event listeners laravel 5.8 events laravel 5.8 feature laravel 5.8 features laravel 5.8 global middleware laravel 5.8 install laravel 5.8 lazy loading laravel 5.8 listeners laravel 5.8 middleware laravel 5.8 multi auth laravel 5.8 named resource routes laravel 5.8 named routes laravel 5.8 new feature laravel 5.8 own artisan command laravel 5.8 queue laravel 5.8 queues laravel 5.8 routing laravel 5.8 telescope laravel 5.8 tutorial laravel 5.8 user auth laravel 5.8 user authentication laravel 5.8 what's new laravel 5.9 laravel admin permissions laravel api laravel artisan command laravel artisan console laravel assets laravel auth laravel auth role laravel authentication laravel authorization laravel axios post example laravel background process laravel background task laravel background worker laravel beginner to master laravel belongsto laravel belongsto vs hasone laravel belongstomany laravel best packages laravel best practices laravel best tutorial laravel bootstrap laravel command laravel command line laravel commands tutorial laravel composer install laravel connect db laravel console command laravel console testing laravel contact form send email laravel controllers laravel create laravel crud laravel crud policy laravel custom command laravel custom middleware laravel database laravel database configuration laravel database relationships laravel database seeder laravel database settings laravel db seed laravel db settings laravel debugging laravel deploy aws laravel deploy digital ocean laravel deploy on digitalocean laravel deploy on server laravel deploy to production laravel deployment laravel digitalocean laravel drag and drop file upload laravel dropzone file upload laravel dropzone image upload laravel e-commerce laravel eager loading laravel eager loading tutorial laravel eager loading with condition laravel elixir laravel eloquent laravel eloquent belongsto laravel eloquent crud laravel eloquent hasmany laravel eloquent where laravel eloquest tutorial laravel events and queue laravel events tutorial laravel factory laravel feature test laravel feature testing laravel fetching data from database laravel file storage laravel fillable example laravel flash message notification laravel for beginners laravel form validation laravel forms laravel forms bootstrap snippets laravel from scratch laravel from the ground up laravel front end laravel frontend tutorial laravel gate and policy tutorial laravel global middleware laravel hasmany laravel hasone laravel i18n laravel installation laravel installation mac laravel intervention image tutorial laravel javascript tutorial laravel jobs queue laravel language laravel language switcher laravel language tutorial laravel languages laravel lazy loading laravel listener event laravel listeners laravel localization laravel login laravel mailable tutorial laravel many to many relationship example laravel markdown email laravel markdown mail laravel mass assignment laravel middleware laravel migrate fresh laravel mix laravel mix 5.8 laravel mix vue laravel model factory tutorial laravel multiple language laravel mysql json laravel named resource routes laravel named routes laravel new features laravel news laravel nginx laravel node modules laravel npm install laravel npm run watch error laravel one to one laravel paginate laravel paginate link laravel pagination laravel pagination 5.8 laravel pagination links laravel pagination tutorial laravel phpunit laravel phpunit testing laravel pivot table example laravel policy laravel preview laravel query optimization laravel queue laravel queue event listener laravel react laravel register user laravel registration laravel registration validation laravel relationships laravel reset password laravel role middleware laravel role permission laravel roles laravel route group middleware laravel routes laravel routing laravel routing with parameters laravel sass laravel save file to database laravel scopes laravel seo tutorial laravel server laravel session data laravel ssl laravel supervisor laravel tailwind css laravel tailwind setup laravel tdd laravel tdd tutorial laravel telescope laravel telescope installation laravel telescope tutorial laravel test driven development laravel test workflow laravel testing laravel testing controllers laravel testing tutorial laravel tools laravel translation laravel tutorial laravel tutorial for beginners laravel ubuntu server laravel ubuntu tutorial laravel unit testing controllers laravel upload file laravel upload image to storage laravel upload multiple files at once laravel upload multiple image to database laravel upload multiple images laravel url slug laravel vue laravel vue js crud laravel vue setup laravel vue tutorial laravel vue.js laravel webpack error laravel webpack tutorial lazy loading lazy loading laravel lazy loading vs eager loading learn laravel learn laravel framework step by step localization in laravel localization laravel many to many laravel mvc tutorial for beginners in php mvc tutorial laravel mysql mysql relational database mysql relationship n + 1 problem n + 1 problem laravel new artisan command npm install npm run dev npm run watch laravel one to many one to one one to one laravel own artisan command pagination pagination bootstrap pagination bootstrap php mysql pagination laravel pagination laravel bootstrap pagination links pagination php php php artisan php carbon immutable php framework php framework 2019 php what's new 2019 phpunit phpunit laravel phpunit testing pivot laravel policy laravel polymorphic relationships queue and events queue email queue for laravel queue jobs queue laravel 5.8 registration form relationship laravel eloquent relationship mysql restful controller role permission in laravel roles laravel route model binding laravel routing in laravel save image to database seo friendly seo friendly content writing seo friendly website seo laravel seo optimization simple pagination laravel slugify sqlite relational database sqlite relationships between tables symfony command console symfony laravel tailwind css tailwind laravel mix telescope laravel tutorial laravel unit testing unit testing laravel upload file laravel upload file php upload image laravel upload image to database php upload images laravel upload multiple files in php url slug laravel url slug php vue vue.js vuejs laravel why use laravel queue why use queue