How to Install an SSL Certificate for an OpenLiteSpeed Website with LetsEncrypt
hey everyone this is tony teaches tech i’m tony and in this video i’m going to show you how to install a free let’s encrypt ssl certificate for your website that is running on an open litespeed web server so that’s something you’re interested in let’s get on into the tutorial here and we’re going to be working with my website called site1.xyz it’s just running you know a basic theme 2020 theme here not much going on and as you can see it is not secure right now because we don’t have an ssl certificate installed so in order to install an ssl certificate we’re going to use let’s encrypt it issues free ssl certificates through an automated manner.

So I’m Going to Show You How To
using cert bot so i’m going to show you how to do that what we want to do is to log into our server via ssh my server is at this ip address so i’m going to go ahead and do that and the first thing i’m going to do is do an apt-get install cert bot okay like i said certbot is what’s going to enable us to ask let’s encrypt for the ssl certificate verify that we own a domain name and issue that certificate to us so that’s done installing and i because we there’s multiple different ways we can do this but i’m just going to paste in a command here and we’ll walk through it.
to show you what’s going on here so we’re going to execute the certbot command we’re we’re going to request the certificate only that’s what cert only means and that’s the reason we’re doing that is because this is an nginx this is an apache if it was we could tell certbot to specifically install the certificate for us directly like without any configuration because it knows where those those servers are but certbot doesn’t directly support open light speed so we have to do a little bit of manual configuration so that’s why we have to specify the web route for our website and the web route for us and by default should be at user local lsws and.
then whatever the name of your virtual host is for me it’s example and then i have all of my html css javascript content specifically the wordpress installation inside a subdirectory in there called wordpress so that’s why you see that full path to my webrew and then dash d is short for domain or domains and you can supply a comma separated list of domains and like you saw this is site one so we want an ssl certificate for site1.xyz and www.site1.xyc so if that makes sense go ahead and change the values for your case and then we can go ahead and hit enter and this is going to ask us for our email address and this.

So I’m Going to Type in My Email
is for renewal notification so i’m going to type in my email address so tony at tony teaches dot tech do you agree with their terms of service yes do you want them to send you additional emails not really and now it the reason we gave it the path to our web route is so that let’s encrypt can actually verify that you own that domain name so it’s it’s i’m guessing it’s putting some type of file um in your web route temporarily while it verifies that and then if it sees that file from its perspective on the outside then it can assume that you own that domain name at a certain level so that’s what we’re.
waiting on here we’re waiting for that verification uh to go through and it usually doesn’t take this long but because it is taking long oh no i was gonna pause the video but it’s it’s done so we’re good to go we don’t have to pause anything um you can see here that your certificate and chain have been saved at this directory the etc let’s encrypt live site1.xyz site1.xyzfulchain.pem directory here so i’m just going to copy that and your key is at that same directory just called prive key.pem okay so that’s great let’s go into our web console for open light speed and tell it about these certificate files okay because at this point you just.
have some certificates sitting on your server we have to tell our web server about them so we’ll leave this in the background we’ll go back to our web browser and i already have my lightspeed web admin console open here and let’s go ahead and do what i just said let’s go ahead and tell open lightspeed about these certificate files so we can do that by going into our listeners section and the the one thing uh depending it depends on how you have your server set up you might if you’re like me you probably only have a listener for port 80 which is http unsecure but we want to set up a listener first for http.

Listener I’m Going to Call This I’ll Just
requests over port 443 so let’s go ahead and make a new listener here so we’ll add a listener i’m going to call this i’ll just call https and any ip address is good port 443 that’s important for ssl and this yes this is a secure listener so let’s go ahead and save that so that’s good now we have a listener for https let’s view this and it looks good you have this tab over here for ssl that’s where we want to tell the listener about the the certificate in the key so in here under this first section we can edit that and i copy the path to the certificate file so i’ll paste that in.
and then i’m going to pull up the terminal window here and just so we don’t make any mistakes i’m going to copy the path to the private key and paste that into the private key area here this is a chain certificate so we can click yes radio button for change certificate and then we’ll go ahead and save this save these changes okay so we now have an ssl listener a listener that’s secure we next need to associate that listener with our website so we can do that back in the listeners page if we click on the listener for https view it we want to map our example website which is site1.xyz with that virtual host.
so let’s click the example and we’ll give it the domain site site1.xyz and we’ll save that and now we have associated with this listener site1.xyz so basically that listener is going to just sit there we wait for requests to come over the port 443 and if the domain name matches site one it’s going to go ahead and enable that to serve the page that that website to serve the page so um i think we’re good to go here as it says up here let’s restart the server to apply these changes so you can click on this green circular arrow here to restart the open lightspeed server and now let’s go back over to our wordpress.

This Time Let’s Go to Https Colon Slash
website and this time let’s go to https colon slash site1.xyz hit enter and we see that we get that lock icon and if we click on it look at the certificate it says that it was issued by let’s encrypt and it expires pretty much three months from now so that’s good that’s exactly what we set out to do there’s a couple other things a couple other optional configuration options right now we still have our http version of our website so if we get rid of that s this website still works you might want to redirect all traffic from http to https so let’s go ahead and do that next in order to do that we.
can go back into our web admin console for open light speed and what we want to do in here is go to our virtual hosts and um the website that we’re interested in is the the virtual host example and in here we want to go to the rewrite section up top here and set some rewrite rules down here and i’ll use my cheat sheet over here to and basically all we’re doing is modifying excuse me modifying our htaccess file so this might look familiar to you we’re basically going to take all http traffic and send it over to https so let’s go ahead and save those changes and refresh restart the server again and hit.

Icon So Let’s Go Ahead and Do That
ok and when that’s finished we can come back over here and now if we refresh this page or you know if we explicitly go to http colon site1.xyz it should redirect us to the https version and we should see that lock icon so let’s go ahead and do that hit enter and that’s exactly what happens so that that website is not accessible anymore the http version of our website is not accessible anymore there’s one other optional configuration option that you might want to do and that is just to completely get rid of disassociate the this website with the um the unsecure listener so to do that you would just come back over here to your.
listeners and before we had this under the default listener whoops i don’t want to delete it under the default listener we have example site1.xyz still associated with that simply just get rid of that and that delete it yes and then doesn’t ask us to restart it but i’ll just restart it anyway go try it out that http website is not accessible anymore so that’s um how you install an ssl certificate with let’s encrypt on an open lightspeed server let me know if you have any questions in the comments below i’ll be more than happy to help you out and if you want to see some other videos about open light speed configuration options and all.

That Stuff Check Out One Of
that stuff check out one of these videos over here and subscribe to this channel if you do i’ll see you in the next one [Music] you.

