Amazon Lightsail Training Series: Course 2, Connecting and hosting static websites | Chase Raz | Skillshare

Amazon Lightsail Training Series: Course 2, Connecting and hosting static websites

Chase Raz, University Instructor, Corporate Trainer

Amazon Lightsail Training Series: Course 2, Connecting and hosting static websites

Chase Raz, University Instructor, Corporate Trainer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
15 Lessons (1h 37m)
    • 1. Amazon Lightsail Training Series: Course 2 Introduction

      1:15
    • 2. Connect to Lightsail via the browser

      1:43
    • 3. Download your Keypair to access Lightsail

      4:37
    • 4. Connect using SSH via PuTTY on Windows

      13:32
    • 5. Connect using Terminal on macOS or Linux

      8:02
    • 6. Create an SSH Tunnel to Lightsail

      7:13
    • 7. Transfer files via SFTP with FileZilla

      3:21
    • 8. Presentation: Review LAMP's abilities

      4:44
    • 9. Host a single static website

      6:12
    • 10. Navigate to Apache's configuration

      11:37
    • 11. Backup Apache's configuration

      0:56
    • 12. Include VHOSTs in Apache's configuration

      11:40
    • 13. Configure Apache VHOSTs for multiple sites

      8:40
    • 14. Point more domains to your Lightsail Instance

      10:16
    • 15. Verify that all sites work

      3:40
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

42

Students

--

Projects

About This Class

Note: This is the second course in the Amazon Lightsail Training Series.  All courses are available to you with your paid subscription to Skillshare.   

  • Course 1, Creating your VPS Instance
  • Course 2, Connecting and Hosting Websites (This Course)
  • Course 3, Using MySQL and phpMyAdmin for dynamic sites (Coming March 2018)
  • Course 4, WordPress Installation and Management (Coming April 2018)
  • Course 5, SSL Encryption using Certbot and Let's Encrypt (Coming April 2018)

This this second course in the Hosting Websites on Amazon Lightsail series, you'll learn a number of ways to connect to your Lightsail VPS instances including the web client, macOS terminal, or PuTTY on Windows.  You'll also learn how to connect an FTP client such as FileZilla using SFTP (FTP via SSH).

After connecting to your Lightsail instance, the connections will be used to first host one, and then multiple, static websites.  Future classes in the Hosting Websites on Amazon Lightsail series will detail how to get access to MySQL--which is already installed--in order create dynamic sites and web apps.  For now, Apache configuration files will be introduced to allow for one Lightsail VPS instance, and therefore one Static IP address, to power multiple distinct websites at different domains, subdomains, or any combination thereof. 

About the Instructor

The Hosting Websites with Amazon Lightsail training series is taught by Chase Raz, a University Instructor, Corporate Trainer, and Consultant with nearly a decade of experience teaching adult students, both academically and vocationally,  in the disciplines of business, technology, and marketing.

Meet Your Teacher

Teacher Profile Image

Chase Raz

University Instructor, Corporate Trainer

Teacher

Chase Raz is an instructor of digital marketing and business technology at Full Sail University and a corporate trainer for Polk State College's Corporate College. Chase has almost a decade of experience teaching business and technology topics to a wide array of adult students; from college students to executives. It is Chase's mission to help others achieve their desired success within business. Chase also owns RCR Business Ventures, a firm specializing in venture development.

A.B. Gamma is the leading corporate training solution from RCR Business Ventures. A.B. Gamma provides business and technical training for business owners, executives, knowledge workers, and almost all other types of professionals. The "Chase Raz" brand of training is the flagship training product from A.B.... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Amazon Lightsail Training Series: Course 2 Introduction: Hi. I'm Jisr as a university instructor, corporate trainer and consultant. And this is the second course in a series, of course, is here on hosting websites with Amazon Lightsail. Now, if you've never used Amazon lightsail before or if you don't have an instant spun up, you're gonna want to go back to the first course in this series here on skill share. And it's called Amazon Lightsail creating your VPs instance. Now, if you already have an Amazon lightsail account and an instant running, or you already know how to create these VPs instances on Amazon lightsail, this course Amazon lightsail connecting and hosting websites is the next stop in your path from here. After we complete, this course will move on to additional courses like how to set up a wordpress module or multiple WordPress modules, how to install SSL certificates and many other topics. So in the course activity in the course project for this class, take a look and I'll provide an additional pdf that shows all of the courses available as a part of this Master Siris on hosting websites with Amazon lightsail Again, I'm chase rise if you're ready to go. If you already have a VPs instance on Lightsail, let's get started 2. Connect to Lightsail via the browser: One of the really great things about Amazon Lightsail is that we don't have to have complex software in order to connect to our VPs. In fact, if we're on our main page here that showing our instances, we can see an icon that looks like a terminal icon. And if we click it, a separate browser window will open. So you'll have to enable pop ups. And here is a direct ssh. Remember, that stands war secure. Shell. Here is a direct S S H connection. It provides a wealth of useful information. The operating system that's running the bit NAMI lamp stack version, some documentation links in case we need some support. Akin. That's why I'm here. These air a little bit lacking and even my last log in details. And you can imagine I'm gonna be blurring my i p over here on the right hand side that you do see another i p as a part of the Lennox user name. This I p right here that I have highlighted is the private I p of the aws lightsail instance. This is the I P that you would utilize inside of Amazon aws to connect this instance to, let's say additional storage or anything else you'd want to connect it to. Now we're gonna come back into this in just a moment. I'll be showing you in the next video how to connect using some other tools. But you can access the same ssh terminal if you are in the management for your instance itself. So if we click on the instance, remember this where we have the connect and storage and metrics and networking options the first, most prominent button right here. Connect using Ssh! Now that's gonna be directly through the browser. And there we are again. So either of those two methods will look at how we connect through software in just a moment, and then we'll come back and get toe work getting this VPs to host our websites. 3. Download your Keypair to access Lightsail: If we're going to start connecting with our Amazon LIGHTSAIL instance, we're going to need an S H Private key. Now this private key. It's just like a private key you may have used with email or any other type of encryption. And what's gonna happen is instead of logging into Amazon, lightsail with a user name and password, will use a user name, but will provide are accessing software, whether it's an ssh client or FTP hopefully secure FTP and we'll walk through that in a little bit. But we're gonna provide these software applications with our private key. And this private key will be used instead of a password to indicate that we are the owner of the account and we have access to the account to get one of these private keys. It's fairly easy and straightforward. What we're gonna do is we're going to select on account in the upper right hand side of our dashboard, will be given an option that gives us account customer support and sign out options. We're going to select account one more time now on the account page that a phone view here is just letting us know that lightsail uses your AWS profile. So aws the larger part of Amazon's cloud, where you can spend up servers and do networking and register domain names and and do serverless functions. All of that type of stuff lives in the AWS side of the house. Over here on lightsail things air simplified things are taken care of for us behind the scenes for the most part. And that's what we're being told here, along with our account i d. What were interested in is clicking on the option for S S H keys. Now here's how as S. H keys work keys in lightsail, just like in the regular part of AWS are region specific. Since keys are tied to region, we're going to get it a fault key any time we open an instance or create an instance rather and any of the region. So I created an instance in Virginia, and I have a default key here. But if you wanted to use a different key pair, you could always set that up at the time that you're building your instance. If I did want to create a new ssh key pair, I could click create new, but what we're trying to do right now is get this default key pair that was generated when we turned our instance on a Rather when we created it. Someone to select download. This is going to download the actual keeper file, which is a P e m file. We're going to need to do something with this later for a couple of applications. But right now I'm going to save this and we need to be sure to save it somewhere that's backed up and secure. The security part of this is the most important, and I'll be going over. Why, in just a moment So I will save behind the scenes. You can't see me doing this right now because I'm off screen. But I am verifying that might keep air was downloaded and Okay, I do have it. I verified it. And for me right now, I've just dropped it into my downloads file because this is a trash account for me doing this training again for my rial ki pair. I have that stored and backed up in a number of very secure locations for myself. So now that I have the keeper downloaded, I'm gonna pull this on screen so you can see I have protecting myself. You're not showing a lot of my information, but I've created a folder in my downloads area called Key Pair. This is the file we're looking for, and this is what it looks like. So again, I have the file and we're gonna be utilizing that in just a moment. Put this somewhere secure. Remember where you put it. Remember everything about this right now because this is the file we're going to need moving forward beyond that. One thing I'll say is you'll hear a lot of talk out there about Onley being able to download a key pair once. I've I'm sure that may be true in some other situations, but if I do a refresh here, I mean, you can see I still have the download option available to me. This default key pair. I'm able to download this several times as long as I have access to the account. Now, I believe I can download it as many times as I need, but you don't want to download this many times. You want access to that key pair, You want to keep it somewhere safe. A couple of other notes before we wrap up this video, Remember? Like I said before that these key pairs are tied to a region. So if we were to create a key pair for the Virginia region, we could not use that later in the Oregon region or we couldn't use it in an overseas region, and we can only have 100 key pairs per region. So if you're gonna ramp this up and go crazy and you run a lot of servers on lightsail, keep that in mind. I don't think you're gonna hit this upper limit threshold. It may be more common over on the AWS side of the house, but they keep it in mind just in case. 4. Connect using SSH via PuTTY on Windows: we have our instance running, and we've been able to connect to that instance using ssh right here in the browser. But we also want to connect using some other type of system. Now, I'm running a primarily Windows based tutorial here, So if you need instructions on how to do anything like this on Mac OS or Linux, please let me know, and I will create a video for that if I get enough request for it. But right now I'm going to stick to Windows specific. And by the way, even if you are on Mac OS or on Lenox, they're going to be plenty of ssh clients that you could just look up on the Web or that you may already be familiar with from when you are using traditional shared Web hosting that you could apply these same principles to and connect to our aws lightsail instance find. So the pizza software I'm gonna be using its called Putty and Putty is actually located at this very long address that you're seeing on screen right now. And I don't know about you, but I don't want to remember all of that now. I don't know who runs putty dot org's. But I will tell you that putty dot org's has for many, many years been my go to because it contains a direct link to that website Again, I can't vouch for this. Always being the same, I don't know who's running this. I'm led to believe that it's bit Vyse because of this claim right here. Below suggestions are independent of the authors of Putty and its two pieces of bit vice software. So I'm led to believe that, but I'm not quite sure. All right, so either way, you can just google putty you can being putty. You can get to hear however you want But this is the page we're looking for. Just double track that you have the right you are l What we're gonna want when we reach this page is the proper installer for our computer. Now I'm running a 64 bit version of windows, and you probably are too. You'll want to double check and make sure if you're not sure how to do that, just set your windows key and type about you could be about your PC option and you see, over on the right hand side. You can see a little bit about my computer here. I'm gonna blur some of this out. You can see that I have a 64 bed operating system with an X 64 based processor. Yep, I'm running 64 bit. Join. Click this link. Save the file. That a move to my downloads. And once it's downloaded, we'll run the installer. It's not a very big file, but through the power of time lapse a couple of seconds elapsed. I'm going to now run this file. However you get to it because I'm running this file directly from within Firefox. I'm getting a prompt asking. Do you really want to run this execute herbal file that you just downloaded from the web? And yes, in this case, I do. So the installer is gonna launch here. Just go through the next screen, indicate where you want to place Putty already have this on my computer, so I'm gonna be bailing out. I'm gonna use that chicken eggs it right at the end. And if you're not familiar with that term, don't worry. It's the exit that's located closest to a roller coaster so that people can go through the line with their friends and family. Then this disappear through the chicken exit before they have to get on the ride. All right, so I'm going to say next after I indicate wherever I want install the file will be asked what products we want to install. I'm going to install Putty. If you want to add a shortcut, feel free. You can also choose Enter leisure to do this third option for using command prompts. But the thing we absolutely have to have is this bottom option associate PPK files with Putty gin. That's what we need for this installation. So install putty associate PPK. Those two. As long as you have those, we could go ahead and click install again. At this point, I'm going to take the chicken exit and say, Cancel. Yes, I'm sure I want exit because you would have click install and putty would be installing on your computer right now. All right, so once. But he is installed. Go ahead and load it and what you'll see is a screen like I see right here that's just floating over my over my browser. And this screen is particularly important to understand if you've never used Putty before because it's dialog box is not going to remain on screen when we launch an ssh instance. If we were to tell Net or ssh into a remote system in this case ssh into our lightsail VPs . Well, if we do that, this window is going to disappear, and I'll demonstrate that right now I'm gonna connect to a weather service using weather underground simply, And I'm tell netting into this, by the way, So I'm just going to open that connection. If you didn't know this is kind of need weather Underground still operates their original Tell that service that they launched with I Want to say in the early nineties and you can, let's say in Tampa is the closest city to me. I'll get the weather for Tampa 67 degrees right now. And if you know anything about trampy no, I'm recording pretty close to the winner to be getting that type of temperature in the daytime. It's early morning on, I'm recording, but still. Anyway, my point is noticed that that screen that we were on before has gone away, and if I were to close this putty window Are you sure you want in a closed session? Yes, I am. That configuration that settings page is no longer here. I have to launch party again in order to get it back. All right, so I have a few connections already set up over here, but we want to create another one. We want to create a configuration that enables us to connect to our VPs instance. How do we do this? Well, first things first, we're gonna need our static i p address. So I'm gonna copy the static I p address. It will come over into our party configuration window, and we'll type it up at the very top. Port 22 can remain the same. Make sure that ssh is enabled here in the second row. We're going to want to save this session so that we don't have to type this in every time we want to connect. So I'm gonna call this something like aws lightsail and for me, I'm gonna call this demo. You can call this whatever you wanna call yours, but just make a descriptive. So you understand what you're connecting to. You can see some of mine below. I have a connection to a different hosting service. Um ah. Website Eireann on lightsail yet another late sale. Instance that I'm running a couple of different websites on and then a couple of tell net services that I use from time to time. So we do want to make sure that we create a name and as soon as we create that name, let's go ahead and click Save. Ah, look, there it is. There's our item aws lightsail demo. If I were to click load, nothing's going to change. But let's say we're on one of these other ones. There we go and I click Load Wrong one click load. There we go. It saves the i P address in the port number for me. Now, as much as you'd love to jump down and click open right now, I would too. But remember, we can't. So if we log into a lot of these services, like all log into SDF, which is a public shared UNIX system out in the west coast of the United States, if I were to load that profiling, open it. And this is not related, um, to light sound. Anyway, I'm just demonstrating something here if I were to log in as me. My name is Chase rounds there. It's gonna ask me for my password. Well, we already know that Lightsail is not going to do this. And no, sorry, folks, I'm not gonna enter my password in front of you. So close that session. Go back to Putty. But we know that LIGHTSAIL is not going to ask us for a password. We're gonna have to use our key pair, so I've loaded my AWS lightsail demo configuration again. You call yours whatever you wanted to call it. But one of the problems with having to pass a key pair over to Putty is that the party doesn't understand the p e m. File that we would have downloaded from Amazon. It simply doesn't understand that final type it has to utilize it's own and then file type is PPK or Putty Private key. So what we need to do now, before we can even connect to our VPs using putty is we need to use another piece of software that came with putty called Putty Jen B u T t y g E n. We need to use this other piece of software in order to create a PPK file from r P E M file . So here's what I'm gonna dio in Putty Gen. Which again just hit your windows key and type e u T T y g e n and Windows search should bring this to the top the top of your search menu. If it doesn't, please make sure that you did download putty and that you have it installed. If you do have putty installed and you still don't see Patijn, this installer should have done that. But if you don't, you can stroll further down the putty page, and you can get a link directly to download Putty Jen again 32 or 64 bit. But either way, once you have putty gin up, what we're gonna do is we're going to load an existing private key file Click Load, an off screen I had navigated to my Downloads folder because that's where my P E M file from Amazon is. But when I first load that downloads folder, look at this. There's nothing there. We'll take a look at the lower right of this window. Putty by default is set to show only its own type of private keys the PPK, zor putty, private key files that we're talking about, which is click this drop down arrow and select all files. There it is. There's my PM file. I was selected and say open. I'm giving a little bit of a prompt saying that the import was successful and that in order to use this key file with Putty, I need to click, save private key and convert this to parties own PPK format. So I'll say Okay, there and down here in the bottom, this is the option we're gonna be looking for save private key. Now, if I click that button, I'm going to be asked if I want to continue. If I'm sure I want to continue rather because I have not created a pass phrase. This is an additional way. If you want to add some type of past phrase or password essentially onto this private key for our sake, we do not want to do that at this time, so I'll click Save private key again. Here's that prompt. Are you sure you want to save this key without a pass phrase to protect it? Yes. Now I'm gonna be prompted to save this key pair in PPK format. I'm actually going to change the default name here because I created my instance in Virginia. I'm gonna call this key pair of Virginia default, keep air, and this should go without saying at this point, this is one of the times in which you're going to choose your own adventure and pick a name that makes sense for you, Virginia default key pair for me. Makes sense. So I'm going to save that file for her to take a look back into my file. Explorer, I'll see a secondary private key. And here it is. Virginia default key pair dot PPK. This is the file I'm going to need toe load back into putty up, Dutch buddy Gen Toe. Look back into putty in order to connect to our VPs instance. All right, so here's how we do that. We have our AWS lights of demo or whatever you've called yours loaded. We're going to go all the way down on the left hand side, under category, under connection. We'll see an option for ssh. We'll click that we actually need to click the little plus next to it. So we're gonna expand the ssh option, and we need to select on off at the bottom of off towards the right hand side. We see an area where we can place our private key file for authentication will simply browse navigato wherever we have our PPK file stored, select it and say open Now, before you do anything I know the temptation is here once again to say open and actually connect to your instance. What? Please, please, please do not forget to scroll back up. Go back to session. This is important because I have to come back to session. But I also need to re select my my session that I want to update. And I need to make sure to click Save I have to do both. I have to re select and click Save. I did it twice there. You only have to do it once, But if you were to just click save even though this session is selected and memory, we didn't see it selected. Meaning highlighted in blue or whatever. Your selection color is on your computer. We didn't see it Selected soap. I have had instances in the past where I don't explicitly, you know, tell party what it is I'm trying to save, and it would just not save it under the right place, or worse, not save it at all. So at this point, we want to make sure that we have done that, and then we can zoom back out and move on from here. All right, So now this session is loaded. Has its private key connected? I'm simply going to say, open this configuration Dialog will turn into my assets h terminal. And it did off. He asked what I want to log in as this is gonna be the same ads logging in the browser. My name is bit NAMI. And that's because Amazon lightsail told me that if I take a look at our instance, manage my instance. My user name is bit NAMI. So if yours is different, use whatever light salads presenting you with here. But my user name is bit na me so I'll hit Enter And the second line is the most important here. Authenticating with the public key. It's importing that file. Everything is successful and here I am wonderful. We've now connected to ssh through punny everything that we could do in the browser Weaken do here. But there are other reasons we needed to connect through Putty or something like it. And we're going to experience that coming up when we establish an S S H tunnel into our virtual private server. 5. Connect using Terminal on macOS or Linux: Let's want through really quickly how to connect from Mac OS or OS X. Whatever you wanna call it these days. But on Mac Os, connecting is fairly easy because Mac is based on UNIX so we can use the built in S S H commands. Ssh! Right now. Here's here's the set up. We need to move our p e m. File our default. Keep air. We need to move that onto our Mac book. So if you're logged in tow lightsail just go ahead and download it. If you were using another computer, maybe Lennox or Windows and you have that key file move it over to your Mac device and I've done that here, and I don't advise you to place it where I have is. You can see I'm gonna change directory here to the very top directory of my hard drive and I've placed my file here. I've also renamed that you can see keep aired on PM I didn't want to type a lot in this demonstration, but whatever your key pair is called, that's what you'll be typing. I'll be typing. Keep air dot PM because I've renamed it hears all this works basically, and I'm not gonna follow through with this yet because we want to do some set up to make this a little bit more useful for us in the long run. But bottom line, what we would do is we'd log in through ssh by calling ssh and then logging in with our user name. For most of us, it's for almost everyone. That's a bit NAMI at and then r i b whatever that is, right, And we want to be able to hit enter at this point and log in now. We can't do that just yet because we could do something like this. Ssh! We could use an eye flag and call the key pair. Now you can see why moved, uh, to keep air to the top directory. I didn't want to type a bunch of directories when, when illustrating this, especially since I'm not heading inter after and then we could log in with Use your name at I P address, right? But here's here's the difficulty of that. We don't want to have to type the directory and the key pair every single time we're trying to connect. So in order to process this. Here's what we do on a Mac. We first want to move our key pair into a very particular folder, and I'm gonna show you where this folder is. Do you see at the top level again? If you're not where I am, change directory to your very top level. The hard drive. And you see this folder right here. It's just the tilde inside of that. Tell them you actually can't see it. Here. Um, let me do this. Gonna list. All inside of that is a hidden folder called Ssh period. Ssh, right, period, Because it's hidden. And so what we want to do is we want to move going back to my top level directory here. We want to move this key pair into that hidden directory. So let's do it. Move in the keep hair, dot PM or whatever years is called wherever it's that don't forget your directories and where I want to move. That, too is still the ford slash dot Ssh. Permission to nine. You know what I forgot, pseudo. Sometimes when I'm on a Mac, I forget to pseudo um I don't know why I just I just dio I'm gonna be asked for my password . Type two, then that the night sight the name Wrong. I'm gonna do this one more time. I just can't type today. Apparently so pseudo envy key. Pair that PM right. And make sure I take that right and where I want to put it until the board slash stop. Ssh! All right. So, uh, the file has now gone from my top level directory. Let's change directory into that hidden ssh folder. And we can see there's a key pair we now need to perform a change mode because if your final permissions air too broad, Mac os and and by extension, Lennox or UNIX will just say no, we're not going to allow this. So we're gonna change mode that C h m o d. And we want to set this to 600 change mode 600 or file here. Key aired on PM I'm in the directory so I don't have to type the directory. There we go. I'm hoping that did that. Let me let me double check. There we go. Yeah, that looks right. Yet that 600 Okay, Perfect. So let me clear this for just a moment. and I'm going to illustrate one more time without hitting without any hitting enter. What we could do at this point is log in. Ssh. I use the eye flag point to the key pair and then log in. All right, P address you get. You get what goes on here. So we could do this, right? And then basically the terminal would say, Look, I see this key pair. Do you want to add this site as a known host? You want to make this connection? You want to establish this and you think Yes, Absolutely, I do. And you tell the terminal Yes, I want to do this. The problem is, if you were to restart your computer that the whole connection is gone, it's It's not gonna be retained. So what we want to do is add this key pair whatever you've called yours again. Remember, I've renamed mine this the fault key pair that I've called Keeper. We wanna add it to the max key chain. Doing that's not very hard. We actually have a command we can use called Ssh. Add. So when you use ssh, add with the flag of a capital K, let me show you Why? For just a moment I pull help up for ssh at U C. Capital cake is store past phrases in your key chain. So ssh add K. Now we want to provide the directory to the key pair which remember mine where we just all moved it. Hopefully we all moved it here until the Ford slash period. Ssh! The head. NASA's h holder and I've called mine key pair dot PM You don't want to be this generic with your naming If you're gonna be doing multiple instances just for training purposes, I hope you understand is why I've named mine such a generic key pair dot PM Right. So I had that into the key chain Identity added. Everything looks good here, and that's wonderful. So now look what I can dio. I don't even have to reference it. I'm just going to go Ssh bit not me that is going to take me a moment. I've gotta manually type this I p address. I am so used to a 10 key on the right hand side using Windows and Lennox devices that I don't have a 10 key on my Mac book and it makes things really slow. So here's what happens. We have added that key pair, so we are logged in to our bit. NAMI instance. On Amazon lightsail. Right now all we had to do was move the key pair to our computer. Whether that means downloading it, doing a file transfer from the other computer we've been using, we move that into a special hidden ssh folder. We then added a reference to that file into our key chain, and then we used the ssh command log in its that simple. Until look, I'm logged in to my remote VPs and verify that. Let's get a directory listing. There we are, ABS, but NAMI application password HD Dog Stack. We are in home slash, but NAMI, that's where. Rat. So if you want to log out, log out now we're back to our Mac book prompt, So hopefully this has been useful for you again. Just follow these steps, wants this video a couple times. If you need help with it, make sure you're adding the file to your key chain because if you're not, when you restart your computer, things will no longer work. You'll have to reset you'll have to basically add that key pair every single time, not add it to your computer percent. But you'll have to type it into your ssh command the first time you log in every single time your computers you started and we just don't wanna have to do that. All right, so that's how to connect from Mac OS. 6. Create an SSH Tunnel to Lightsail: so far, we've connected via ssh in the browser and we've connected via ssh! Using a program like putty. Now the question may be, why would we want to use this outside program like Putty when we have the connection built into the browser? Why make this difficult on ourselves by requiring more software? Well, one of the reasons is we want to be able to access the services that are available to us using this instance and the lamp stack that's sitting on top of it. Let's take a look at what I mean. I've pulled the public I p which is R static, I p and I've opened it in a different browser window. One of the things we may want to do it for building a Web application or building a website is we may want to use a my SQL database of this make sense. We we've installed a lamp stack, so our databases, my SQL in our language is gonna be PHP the demonstrators I've navigated to our static I p and I'm going to select the option here access PHP my admin. Now, if you've built websites before using the lamp stack, you're probably familiar with PHP mind men. What it does is it enables us to utilize a web front end to manage my SQL rather than having to do everything command line. Now, this was interesting when I clicked through. I simply get a page of kind of complex instructions telling me that I need to use PHP Mayan men in combination with an ssh client on windows. Now, if you're using OS acts or something else you can skim through this page is Well, I am taking a Windows centric view here. The other information is here, but we can apply the same type of structure. If you're on OS acts, it's gonna work. I connect in through a sex I connected through Lennox and I'll walk through the process here on windows. If you were to read this entire documentation, you're basically gonna be told this PHP mind men is accessible only when using 1 27.0 does here on a one as the host name. Let me put that in English. We can Onley connect to PHP Mayan men if we are local host this 1 27 0 Jonah one is the i p for local host. So we need to be connected in to the system essentially. And we need to convince the AWS instance that we are a part of the local host. We can modify this and PHP mind men. I'm not going to for security reasons, but basically what it's doing is saying, OK, if you're logging in from your local host and you're creating a connection to this remote instance and getting into PHP my admin that way that means that Amazon servers this security configuration, is sure that you're the owner. And the reason is because you're connecting to the remote instance through ssh! With a key pair, thereby verifying your ownership are really complex. But let's take a look at what we mean. How would we navigate to PHP? Mind men? Well, the directions air going to suggest that we take and access through local host for 1 27.0 dot 0.1 is we talked about before and we're going to map port 8888 over to our VPs instance , and then we'll simply access Ph. B my Edmund. Now, this isn't gonna work right now. Of course, we have nowhere to resolve to. And likewise, if we're on our I p address BHP, my Edmon can't spell their PHP. My admin won't work because it's only accessible. Using local host is the host name again making sure we're on our computer connected via ssh ! To the instance using the key pair. That's the reason behind it. So we need to use something called s S h Tunneling to circumvent this. Now, all of this has been a lot of talk to describe what's fairly easy to do. We're gonna go back to Putty and in our aws lightsail setting, I'm gonna load that one. You probably only have one, and that's fine. Just select it and click load. We're gonna go back down on the left hand side in this category group all the way down to connection. Ssh. Which is where we were before, remember? But instead of going toe off, which is where we put in our key pair, we're going to instead head to tunnels so connection as this H tunnels and in the tunnels. Aaron are sore. Sport is 8888 That means what we're gonna do is on our local computer. We're gonna access local host port 8888 And the destination that's gonna take us to through the ssh tunnel is going to be a local host. Now, this is now the local host for the VPs. Instance, local host Colon 80 Port 80. Now, if you're familiar with how the Web works, Port 80 is standard. Http port that websites air delivered over when they're not secure and not encrypted. But we don't have to worry about the encryption. We don't need to move over to port 443 which is our standard https because we're connected through the ssh shell were connected through this encrypted mechanism. So again, this is how simple it is. Sore sport 8888 Destination, Local host Colon 80 ad. Now that's added this up to our forward imports. Please don't forget at this point to come back up to our session and save it right, because otherwise that forded port won't stay an active part of this configuration. And when you come to load putting again, you'll keep having to set that up over and over again. I'm gonna go ahead and open this session because we want to test this out. Open it in law again. We're logged in. So instead of going to the I p address slash PHP, Ed, men are my admit. Scuse me. Which remember, this is where we get our security warning telling us we have to come through local host. We're actually gonna utilize local host or 1 27 0.11 That's your choice. Local host on our end, Remember, we're gonna access port 8888 and this is gonna funnel us to local host support 80 on the remote machine. Now, I haven't run PHP mind men, but I'm just showing you that this is successful. We're getting our landing page, which is on our Amazon VPs instance, by coming to local host port 8888 So all we need to do now is modify this address to go to a local host. Port 8888 ford slash PHP my Edmund. And there we go. Now we have an ssh tunnel tunneling us through these inter webs of ours. Letting us connect remotely is if we're longed in to our VPs terminal is if we were right there and wanting to run PHP my ad men in the last piece of information. Before we move on to the next step, we are able toe log in to PHP mind men. We just don't know how to yet because I know my user name that NAMI, that's that's the user name that was given to me by the AWS Light l Consul. But we don't know the password yet. Remember, we've been using a key pair toe access instead of a password that NAMI has created a default application password for me to remotely log in to these applications like PHP minded men and my SQL. But we don't know what that is just yet, but don't worry, we'll be getting to that information soon enough. 7. Transfer files via SFTP with FileZilla: so far last connecting video. Before we move on to getting into setting up our server, I'm gonna connect using Final Zilla. Now, I'm using Final Zilla because this is one of the more common FTP clients. And what we're trying to do here is establish an FTP or file transfer protocol connection. This way, we can easily send files back and forth from and to our VPs server. If you've used files, it'll before you're probably used to coming in and typing in a host name, which is something like, you know, ftp dot my domaine dot whatever, and then a user name and password. We're not gonna be doing that because we have to use secure FTP. In order to do that in finals, Ellen will go to file. And this is true whether you're on a Windows device or on a Mac will go to file site manager. You can see I have one side here by default. We're gonna click new site in the left hand side below. We'll name it. I'll call this my AWS lightsail demo, right? There's the name I've been using. You can name it whatever you want on the right hand side we're going to be asked for are set up options. So first things first, let's change our protocol because I don't even want to put my host in Just that I want to change my protocol to s FTP. Now we can backtrack and put my host in, and that's gonna be the I. P. Address the public or static I p address for our VPs instance, whichever you're using and then we'll move below to our log in type, which were currently set to anonymous. That's certainly not gonna work. Amazon's not gonna let us do that. We want to move to the bottom option called key file. That should sound familiar. And what we're going to do in this case is change our user name to the user name that we know exist bit NAMI. And be sure to check your AWS console information. Make sure that your user name is but NAMI again, I'm going to the instance manage. Make sure that that is your user name. If it's something different here, you're going to use whatever this user name is. And now I just have to link my key file. Now finals Ill is a lot more user friendly because I can do a couple of different things. Not only can I use the PPK file that we created using Putty Jen, And if you skip that video, if you weren't using plenty to do a remote connection via ssh to your instance, then you may want to go back and look at that video about establishing a connection via party. But what we can do is we can either use PPK, finals or PM files. So either one of our two options either one of our private keys, they're the same key, just in a different file format. But either one of these will work. I'm just going to choose the original PM that I downloaded from Amazon. Lights out and I'll say open. We had comments if we want. I'm not going to at this point. Unlike party, this information and final zilla is saved by default. I'm just gonna collect Connect now takes a moment, and here we are on the right hand side. This is it. We are now connected into the file structure. Four our aws instant using a lamp stack. This is wonderful. We can click through to ht Docks, Rht Docks folder that default information that default view When we load our i p address into the browser, I want to do that momentarily. Let's load our default i p address into the browser This information that I'm circling on screen these are the files right here were now connected via secure ftp. 8. Presentation: Review LAMP's abilities: Now that we have our instance up and running and the connections to the VPs have been established, we can already host a static website. That's exactly what's happening here at R I. P. And similarly, of course, at the domain that we pointed to our static I. P. Apache is running and is capable of serving up documents to browsers and sense browsers are the software tools interpreting the body of the website. We can already use any language that browsers understand so html, CSS and JavaScript. If you're up to date with your front and development, you'll know that these versions are up to HTML five, CSS three and Java script, which, of course, is based on ECMO script. And in the most recent years, what Acma script has been doing is updating to an annual version 2015 2016 2017. And that's been happening sometime around June of each year. All in all, if you're up to date on these technologies, you know we typically just refer to the entire thing as HTML five because we know that for proper separation of structure, design and logic, html, CSS and JavaScript, respectively. That's stating simply the structural language. HTML five will imply all of the others. Next up, let's look at what exactly it means toe. Have a lamp stack. First we have a computer somewhere, a real computer, a Blade server, Iraq server or just some resource carved out of a cloud data center. The computer or instance of a computer runs an operating system for us. That's Lennox. Hence the letter L and Lamp Apache sits on top of Lennox as our Web server, and so what Apache does is it listens to communications ports for requests. These air the time to request that you're making every time you laudable Web browser and visit a site. And Apache listens to these requests, processes any incoming request and returns the appropriate information to the requesting computer. Now PHP is installed, which means that when Apache sees PHP code as a part of the reply that it's sending out that code will be sent elsewhere for processing. Before that, actual reply is returned. And if you're a bit of a technical person, I should say that the PHP process and can be done in a number of ways. First, PHP could be running as a C G I script, but that's a bit outdated and not what our VPs is doing. Second, PHP could be running as a model of Apache called mod ph. B. This is highly efficient, but much less secure. Third and the chosen method for our bit NAMI lamps tax on a W s lightsail is toe hand off the PHP processing to something called Fast C G. I. Now there are a number ways to even do this. But our stack at the time of recording uses F p M. And if I pull apart domain really quickly, and I show you that I've created a page using PHP is PHP info function. We can see that the server AP I utilizes f p m fast siege I that saying We're utilizing fast c g. I threw a tool called F P M. Now all of that's beyond our scope. So let's get back to our lamp stack. So far, all of this has been a very long winded way to say that we can use HTML, CSS and JavaScript right out of the box. All of this collectively known as HTML five. But we can also already use PHP, the thing that our stack allows us to do. But we can't yet do ourselves because we're not far enough along in. The training is we can't use my SQL yet, and that's why I've colored this in red on the screen. At this point, we simply don't know how to log into my SQL, either on the command line or through PHP. My admin. Sure, we've used ssh tunneling to connect the PHP minded men, but we still don't have the password toe log in. That's what I am saying. At this point you can host a static website. You may be able to even generate dynamic elements using PHP and JavaScript, but we're not yet able to create a truly dynamic site, at least not in the way we traditionally defined Dynamic as being powered mostly by a database in the next video, all transfer some existing website code over to my VPs to get a rudimentary site running at our static I P address and therefore at the domain name. We've already pointed to that I p. That was back in section two of this course. I pointed a b gamma dot com to my I P address Then after I make those changes, I'm actually going to undo all of those changes because we're going to talk about how domain pointing and Apache work together later in Section five, when we configure Apache to handle multiple websites and multiple domains. 9. Host a single static website: all right. The time has come. We are about to get our first website live using our AWS lightsail lamp stack. Now we're going to be getting a single site. Just one site. Not multiple domains, but one site way with a static architecture that means no database because we're not there yet. Now what you see on screen, this is my example site. It's just a little site with the A B gamma logo in some text. And I'm illustrating here that we can use HTML and CSS, which is what's powering this site. And you can see I have two pages here. Both are static, one is index dot html and the other is about thought. Html. I'm just running these on my local final system right now because I don't even need to have a local server like Wamp or something like that running because these are just HTML and CSS files. And I figured out how to take a moment to talk about the £800 gorilla in the room. Yes, if you're paying really close attention to my videos, I have been, for some weird reason, hosting all of my files in my downloads folder. I'm just calling it to your attention to let you know. Yes, I know. I don't normally do that. That is a strange thing to Dio. But some people pay a lot of attention to these videos. I would suggest you host these files somewhere. I've made these available for download along with this video. And so now that the location of these files has been addressed, I'll show you what else they do before we upload them. There is a Java script example first and foremost. So if this is simple, we just click the link and a dialogue box pops up saying you click the link. JavaScript is running Well, see? Okay. And get out of there. And then there's a PHP info page. If you've ever used PHP before, you know the PHP info function. And I'm actually not going to call that up right now because there is no PHP running on. My local system will run this once. It is on R I P address and therefore also on our domain. I'm going to save the domain until later in this video, and then we'll check that it works. But remember, we've already forwarded a domain to this I p address. In my case, that was a big gamma dot com. So let's move on over to file. Zillah, this is where the magic is going to take place. And if you weren't already connected, I'm just gonna go to file site manager and connect to the site that we created before. Remember, I called mine aws light cell demo, please. Remember what you called yours. I can't remember that for you, but all we have to do is click connect now more to connect until I'm going to abort the existing connection and create a new one. Now, there was no reason for me to do that. I'm just doing it for the sake of demonstrating. So here we are, on our VPs on the right hand side with our three siblings and our one file at the bottom the bit NAMI application password that will come in handy in a little bit for getting us into my SQL and PHP Mayan men and here in files. Oh, I'm also set to where I can see hidden files and folders. So if you wonder why these others air here, that's why the dot the period at the beginning indicates that these air quote unquote hidden files. All right, so here's how simple it is were in FTP or rather s FTP, which stands for S S H file transfer protocol. Now, I've been calling it secure. FTP. That's technically incorrect. I'm using a cloak realism to indicate that as s h ftp is secure, that's all that's going on there. We're gonna move into our ht docks and all of these files that we've looked at before the standard Congratulations, Paige, that we've been looking at from time to time Looking at documentation. We're going to back this up, and we're going to back this up just in case something goes wrong and we ever want to revert back to this state. So I'm gonna create a directory, right click, create directory. Just gonna call this directory archive. I'm going to take absolutely everything here and drop it into archive. Now, Before you do that, I want to point out I did add a file. I added a PHP info file. I was just simply testing the PHP info file that we're going to move over as a part of our site. So If you don't have that file, don't worry, you shouldn't. It's just something I was playing with while not recording, right. I'm dropping everything into my archive. Now. If I were to refresh my browser, look what's happening. There are no sites. Excuse me. There are no files or images to display and I'm on the main directory, so I'm actually getting a forbidden error. That's interesting, isn't it? So let's move our site over and again. I've made this site available to you as a download. With this video, we're gonna move all of these files over. There are five of them. The index page, which is an html file. The about page, which is also in HTML, file my baby gamma logo, a cascading style sheet file and my PHP info. I'm gonna go back to the browser. All five of these files successfully transferred. So back in the browser, let's hit, refresh one more time and look at that At our static I p address, we have a static website running home. The about link works back to home. Our javascript pop up and now finally are PHP Info will work as well. Wonderful. So if you ever want to know anything about the PHP version or the server environment that PHP is operating within? Here it is, and I'm gonna go back, and we'll also cue this up at a b gamma dot com. And I'll show you that it's working there as well simply because we pointed that domain to this I p address. And so here's how simple that processes would just create a new browser time. Go to a b gamma dot com and look at that are single. Static site is being served from our Amazon lightsail VPs instance. Absolutely wonderful. All right, so that's all for now. After this sections quiz, we're going to move on and talk about how we configure Apache to run multiple websites and even utilize multiple domains to point to those websites with just this one. Aws late stale instance. So I'll see you again after the short quiz to check your retention of the information within this section 10. Navigate to Apache's configuration: what we're gonna be doing in a moment is modifying the Apache Web server configuration files so that we can host multiple sites now, it's pretty straightforward. If we wanted to host just one site, we've already set up fire Zilla, weaken Goto file site manager and load our site. Connect to it. We can replace the files that are in the H T docks with our website or application and presto, we would be hosting one website right here running PHP. We can set up my SQL, which will do in a later video. But we want in this particular training Siri's to be able to run multiple websites using one aws instance. So in order to do that, we're gonna have to modify some of the configuration files. First, we're gonna need to know where those configuration files live. So what I'm gonna do is go back to my life sale dashboard. And what I need you to know now is we've created a lot of different connections to our VPs instance we've connected assets h their browser Ssh! Through putty. We've created a tunnel through party so that we can connect to PHP mind hman and we've created an sftp through files illa. The best way to move forward is to treat ssh as one type, no matter how you access, whether through the browser or party, and treat FTP as a separate connection type and will go through files L. A. Or whatever your favorite browser is. As long as that FTP client can handle using public, he's in order to connect. Have Not again. Final Zillow would be my recommendation. So I'm just going to jump in via as this age in the browser to my bit. NAMI Lamp stack. If you're not familiar with Lennox, this may be a little bit confusing, but maybe think back to if you've ever used DOS or some other type of command line. Now I'm logged in to my bit NAMI image, and the first thing I want to do is I want to see what's here now in Lenox were using the bun to limit so we can actually see that up top here. We're using a bun, too, and right now version 14.4 point five and then long term. What is that? A long term service, I believe it means that's where you get five years of service, so it makes sense that Amazon is using the long term service branch. But if I want to see what's here, I can type the Lennox command. L s for list. It's kind of like DOS with dirt de ir. And so what I have here in this directory are three symbolic links. That's what this light blue kind of science color is all about. These air symbolic links, meaning that they're pointing to somewhere else. Now on the windows side of the world, we know these as shortcuts, but in the Lenox world, they're known as siblings. The other thing here is a file. Now this file is really interesting because it's called bit NAMI application password. And I've alluded to this before when we were creating an ssh tunnel into PHP Mayan men, I mentioned there would be an application password so that we could log in. If we want to see the contents of this file, which is going to be our application password, we could use a small text editor like Nano. It's all tight man of space and then call this file by name and hit. Enter. There's our password It's gonna be a unique string. And no mine won't work for you because I'm gonna delete all of these files and this sentence since anyway. But this is the password. You may want to write this down. Have this on file. Keep it somewhere safe. Now, if you've never used Lennox before and never used the Nano editor, I'm just gonna hold control X. And that will log me out of that nano editor, which is right in the command line. You can see my command line is back at the bottom. I'm gonna type clear. That'll clear the screen. Just like CLS used to do in DOS on a pullup might list my directory again. Ls. And we see a assembling for h T docks. I'm gonna use CD for change directory HT docks. I'm now in that folder, as you can see right here, and I'll get a directory listing here as well. These files that I'm seeing on screen right now, they are the exact same files that we saw in File zilla that are powering the default view of our website. This is them right there again in finals Ella and then back again in our terminal. Someone actually go back to my dashboard really quickly just for my own sanity here. But those are the files that if I wanted to modify my website if I wanted to put a Web application or just upload one website There we go. That's the location. But what I'm gonna do is I'm actually going to show you that when we are at our main directory. So I'm gonna go up a directory CD, period, period. You can see we're back where we were before. This is not the home directory. It's not like we're starting on. You know, the C drive. If we want to go up to our highest level, we would type in CD forward. Slash is going to take us up to the very highest level, and I will do a directory list here ls have a bunch of folders that's the darker blue kind of purplish color. And then in our Scient again we have sem lings. So let me save you a little bit of trouble here, and I'll tell you where we started by default That location where we had abs and the application password and assembling HT docks and stack and all the stuff we see up above here, where that lives, this location is actually at will Change directory to home duelist. There we see one folder called Bit NAMI CD bit NAMI and take a look at this are listing or right back there. We're right back where we were. So go up to the top directory one more time. We see this are very top directory. This is where on Lennox, we have a user directory. We have a root directory. All these things you may be familiar with if you utilize Lennox. And if we want to get back to the starting location when we log in, that's home slash Bignone. Great. I'll clear this one more time. Now let's just for general information. If we take a look at this default director, we get into with assembling, we don't need to go much further than this because what I can do is I can change directory into stack, take a listing. And here are the programs that are a part of the stack. Whether it's get or PHP or minds could help. The configuration finds that we're going to change our right here in Apache two. That's a Web server that we're running so I can change Directory into Apache two. Within this water will have a conference configuration folder Sadie Khan to navigate to it . Now, I cleared the screen really quickly and just cut it out because I wanted more room. And I'm going to do a different type of list here in the confidence rectory, someone to do ls hyphen L. This will just give the directory listing as a list. So the types of configuration files that I have, I have a folder bit NAMI has an entire folder of configuration files that accustomed to them, and we're gonna have to kind of navigate around that I've spent a lot of time chasing this down or navigating this really complex maze of how their files interact with the standard Apache files under http d dot com. And that's a file, as you can see and has been quite a headache, honestly, trying to reverse engineer all of this. But it's not that bad that once you have the process, it doesn't take a lot of work in order to do this configuration. This entire video is simply about navigating to these things. So if we wanted to see are actual Apache configuration file right here in from her home directory, we went to stack slash Apache two slash cont. If we wanted to see this actual file, we could use Nano yet one more time. Nano. And here's the file h t t p d dot com Now, this is a pretty long file, so I'm gonna use page up and page down, going and going and going and going and going. We're probably not well, kind of want to modify this here on the command line. You might want to. Maybe maybe the command line is is your thing. That's wonderful if it is. But for me, I'm gonna move this over into V s code or adobe brackets or something like that. So I can wrap my head around this a little bit better. Someone exit, Nana, remember, that's control X. I'll get another list. Ls hyphen L I will point out one more thing that we're going to utilize. Not only is there the http d dot com which we're gonna make some very, very few minor changes to, but there's also a folder of configuration files called extra. It's all CD into extra. There's one here, so I'll do a list ls slash A? There's one file here that we're gonna utilize. And that is http D hyphen v hosts V Host stand for virtual host. You can imagine that's what we're gonna be using in order to set up our lightsail VPs toe host Multiple Websites Force will use this virtual host feature of the Apache Web server. And let's conclude us I'm gonna clear the screen just because I like everything nice, neat and tidy on the command line and then a monologue off. So I used the long out command. I've been disconnected. I can close the window. Great. But what I mentioned before is that we probably don't want to go in through that method to find these files. Well, look what weaken dio if we bring back up our FTP connection and I would have done here is I've logged out behind the scenes. You didn't see that happen, But I'm going to reconnect to my instance. And when we log in via ftp, look where we're at. We're not a directory that has a couple of hidden files. The period at the beginning of something tells Linux or UNIX that the final or folders should be hidden files. L. A. Is that to display them? We could display that inside of our command line as well. But look what we have. We have a file called Bit NAMI Application Password and three shortcuts or siblings. APS 80 docks and stack were at the same location that we were when we logged in through. Ssh. Knowing that I can double click on stack double click on Apache two double click on Kant. And here are my configuration files. We know the two that were going to utilize r H t t p d dot com which is the main set up in configuration file for Apache. And we're going to use one in the extra folder called http devi hosts dot com. I can set up a nice little folder right here on my computer. We'll call it Apache Configurations. Apache camp and I can get these two files. So I'll take http cough, drag and drop. Create a new directory extras. I should just call that extra, shouldn't I? There we go. And I'm gonna take http D v hosts now. I'm not doing these to modify them just yet. I am going to modify a save as copy that I create in just a little bit. But now I have a back up of these files. And if I'm really smart, what I'm gonna do is I'm gonna take these untouched so that I don't even have the option to manipulate them. I'm gonna take these great copies and create a backup. So on task you with doing that, create a backup of these files, and then I'll still do a save as later Just to make sure. Because if we mess anything up, we want to have original files that we can throw right back on the server. But now we have these files ready to go, Ready to edit. We can move on to the next video. 11. Backup Apache's configuration: you know, on second thought it so important to create a backup that what I've done is I've navigated to my downloads of my Apache configuration files, which I have stored here, right next to my key pairs. And I'm gonna take this folder that has the http d dot com and the http tv host dot com And I'm going to do exactly this right here. I'm going to create a copy. I'm gonna pays that copy in the same directory just so you can see that I'm creating a wonderful back of change the name copy to back up. And we're not gonna touch these. In fact, I'm gonna go one step further. I'm going to create a compressed archive, just in case. Why not? Why not do a tertiary backup is? Well, it's that important. So now we'll move on to actually manipulating these configuration files in our Apache con folder. 12. Include VHOSTs in Apache's configuration: let's do our first server configuration file at it. And, um, you know, at the end of this video, nothing is really going toe happen. We're just going to be better prepared to move forward. So we're doing something but were not immediately going to see. A result were simply setting up the server to accept the type of information we needed to accept in order to host multiple domains. So if that's long and winded, you'll see at the end of this video, it all makes sense. So what I have here is I have my configuration files http d dot com and my http TV host I'm gonna make that where we can see that a little bit bigger there. And I'm going to edit thes now notice I'm not editing my backup. Eso I have two backups ready to go. We're going to start editing for the first time. H t t p d dot com Now, my default editor on this computer is visual studio code. It's the one I prefer the most you can use whatever editor you prefer. Some of the common ones might be visual studio code or adobe brackets or something similar so I'm just going to open http d and we can see what we've seen in our s s h terminal before. This is the H t t p d dot configuration file for the Apache Web server. No, Most of all of these. I'm going to scroll down to the bottom very briefly. Most of these 566 lines are comments. Look at all these green text as I scroll back up Commons on explaining how this configuration file works. What to do inside of this file And this could be rather confusing. And I know that's quite a bit scary to someone who has never seen this file before or worked with it. So I'm gonna walk you through a couple of things that we want to do. I'm going to scroll through. And one of the first sections here within the H T T P. D configuration file is this giant section here that talks about loading modules. And if you look through here, there are a couple that if you spend some time with this document, your attention would probably turn to and so I'm going to go to Lines 151 51. That's four Mahdavi host aliens and mod negotiation, respectively. Now, first, when I'm looking at line 1 50 we may think that I'd want to turn on Mod V Host Alias. We know from these videos already that we're going to be using the V host feature off Apache. But we don't have to turn this module on. In fact, this is something completely different. What this module would allow us to do is some of the type of complex virtual hosts that Web host you realize so if you've ever seen anything where you've got your user name and so you have a file directory like, you know, home slash first letter of your user name slash second letter of you use your name slash full user name. That type of directory structure is typically when when you're serving your webpage, an Apache is relying on this mod V host alias. We don't need this, so leave it off. Leave it commented, which is using the little Octa Thorpe character or hash or pound or number or whatever you wanna call it on the next line below 1 51 mon Negotiation. Leave this on. I know, a lot of people want to come and turn this off because they don't want a feature we know as multi view to take effect. And when we look at our default page, if I go back to our default page here it are static I p. The files that we observed behind the scenes that are running this site there are actually several index files you may have noticed. In fact, I can pull them up really quickly if I go to my my file zilla instance in my HT docks. Look how many index files we have. Index dot html dot g at the end for deutsche German E en for English So on and so forth, right? Why so many of these? Well, some websites are designed so that the Apache Web server will automatically go through and find the appropriate file to display, whether it's language settings or search settings, or depending on what landing page you came from. All ah, whole host of things can factor into this mod ago. She ation. Now, sometimes when developers of Web applications get stuck in this little problem, where because the server is searching for the correct file to display. You may encounter that strange little quirk where if you try to use any type of semantic Earl, you know in the like of like blog's have all the time so you'll have you know your domain dot com slash blog's slash the year slash the month slash the actual slug or name of the block post. And sometimes those won't resolve properly if the server settings and Apache are set a certain way and most people trying to brute force come back and blame this on mod negotiation in a way that's true and in a way that's not sure what's really happening. I guess the best way to think of it is subsections of this feature may be interfering, but long story short, we can control them with HT access files, and so there's absolutely no reason to come in and turn this line off. Okay, so if you didn't know what these two lines are, you can almost ignore the past couple of minutes of what I've been talking about. What we want to do is get to the point where we're making the two changes, and yes, there are only two changes We need to make an almost 600 lines of code in order to get ready to set up this V host concept and host multiple domains from one VPs instance. So let's start at the beginning. And I guess I should say I'm talking about two changes. We're gonna make three changes. And in all honesty, when I'm reviewing what we're about to dio on Lee, one of them is absolutely required in order to get things set up. So let's jump in first. I'm gonna go to line 203 because lying to 03 sets our server administration email and we don't wanna leave this as generic. I'm gonna use the email address that if anybody encounters a problem and gets a page like a 404 page or some type of a server error, I want them to get my email address so they can contact me. My email is inquirer at RCR dot biz writes All used that email address. Just use which ever one you want to be displayed if some, um, some type of difficulty happens and a server generated page is delivered. So that's change. One of three pretty easy, right Let's move down to line 2 57 Next, one more scroll and all right, lying to 57. Okay, So what's happening here is we have something called Allow Override. And basically, this is determining what, if anything, we can place in an HT access file and whether or not that HT access file will even be acknowledged by the server. If you've never used HT access files before, they are hidden files since the period at the beginning that the Apache Web server is going to read before loading a page to determine if any of these server configurations need to be updated in a particular directory or for a particular file. This is how a lot of you URL redirection works on the web. So if you are building a website, you probably do want HT access turned on. I know I do. So I'm going to enable all I'm gonna move from none toe all, and this will allow all directives, all directives to be utilized within HT access files. If you didn't wanna limit this a little bit more, you can see an example online to 55 of something you may want to set But you'd have to know a little bit about how the servers already behaving and what options there even are to set for. So for now, I'm just going to set this line to 57 to all. All right, so that doesn't even directly impact our ability to set up multiple domains. It's this third and final edit all the way down online 5 68 that we're about to make. And as you scroll down, you'll be scratching your head and saying, Wait a second. There is no line 5 68 And that's exactly right. We need to make a new line. Of course, this could go online 5 65 or 5 67 really almost anywhere in this document. But I'm just adding a new include Now this include is gonna look very much like the ones above. In fact, so much so opt. But NAMI Apache two. That's where Apache lives in the configuration files. I'm gonna copy all the way up to there. Just copy and paste. But our file doesn't live in a bit. NAMI folder and it doesn't just live in the main configuration folder. Remember, It lives in a folder called extra. And the file name, of course, is H T t p d v hosts dot com. We'll save that file and next, we need to move into file Zilla I have my file zilla or any other SFTP client open, and I'm already end my directory for Apaches configuration files. So all I have to do at this point in time is take my http defile and uploaded to the server . You'll probably be asked to confirm the overriding of the existing http D I have that turned off in files little by default. But if you are asked that question Yeah, I know it's scary, but that's exactly what we're doing right now. We are overriding the main configuration file for Apache, but we're not done yet. We still have one more step. We have to dio I'm gonna bring up my putty instance or any ssh connection to my lightsail instance, I need to restart the server now, In order to restart Apache, we first have to use a pseudo command because we need root level access from there. I'm gonna call the Apache program using Apache CTL for Apache Control and there's a command I need a pass to that program called Restart. You can easily into it what that does. Now I want to make sure that you're prepared for hitting Enter here because when I hit, enter were actually going to get a couple of errors, and that's okay, so I'm gonna hit Enter. Now. What a panty is telling me is that the V host file the V host configuration file that we just activated is on and running, but that that file that we haven't edited yet contains a couple of directories that don't exist. Therefore, Apache is throwing a couple of ares saying, Wait a second year, you're calling these directories that don't exist. In all honesty, we're not doing that yet. It's just the default contents of the file that we've activated. So we're gonna be updating that in the next video. And if you remember back to the very beginning of this video, I said that we're doing some work here, but we're not really accomplishing anything just yet, except for maybe getting an error. And what I mean by that, I'm gonna bring my brother back up. What I mean by that is our i P address still resolves to, of course, that default HT docks location within our Apache server. But so does our domain. When I type in a b gamma dot com, I'm still coming up to this default place again. This is because we haven't edited the V host file the same file that's throwing a couple of fake directories and therefore some errors. And in Apache, we're going to fix all of that in the next video. 13. Configure Apache VHOSTs for multiple sites: in the most recent video. We were editing this, http d dot configuration file and we added an include line. Let me pull that up really briefly and I'll show you. We added an include line that calls this http devi host file from a folder called Extra. Now, that's all straightforward. This file already exist. We've already downloaded it in previous videos onto our local system and we've made backups of it. So what I'm gonna do now he's bring my files up and I'll navigate to the version that I want to change now by version. I want to change. Remember that we took backups and I don't want to change those. I'm gonna modify the http devi host file in my in my main folder that I am attempting to change. And then we'll upload that to our server later. So I'll just double click and open this file as well. Not unlike the main configuration file. We start with comments at the very beginning, but then at the bottom, we do have some more usable. I guess I'll call this code. It's religious configuration settings, but we have some more usable information at the bottom and if you remember back, we got errors where? Two errors specifically when we restarted Apache after changing the main configuration file and these little sections of code, or why we explored the concept that Apache was trying to load files and really directories that didn't exist. And here they are. These are the folders, the directories that Apache was trying to load. So here's what we're gonna do. We only need one of these to use as an example. I'm going to comment out the lower one, and this will take me just a moment. Not the fastest that walking, talking and chewing gum at the same time. But there we go. We're done. We're gonna take this first virtual host instance, and we're going to point Our are our main domain that we've already been using a b gamma dot com, and we're going to give it its own home here on the server. Now this means that will be hosting two distinct sites. First, we'll have a site that's accessible when you type in the I P address, and second will have a b gamma dot com, which will live in its own directory. So let's just walk through this little bit of settings code step by step and we'll talk about what each line does. First up is lying. 24. This is establishing a virtual host entity and basically telling the the server, Go ahead and listen on Port 80. And when you find something that matches the server name or the server alias that I'm highlighting now, then we're going to power that request using a different directory. So remember that Apache is loading all files currently from opt. But NAMI Apache, two H T docks. And now these two little bits of code that we're here by default are suggesting that there should be another folder which, by the way, that's doesn't exist in the default lamp stack that we should have another folder called Docks, and we should place our sites and sub domains and whatnot inside of that. Now, this is not what we want to dio. At least it's not what I want to do. Actually want taken any time. The server name a B gamma dot com, is requesting information from Apache. I want Apache to return the information and opted it. NAMI Apache, two H T docks and for now, I'm actually gonna leave this blank for right now. I'm not gonna put a subdirectory in just yet. I will in a moment. But you know what? If I leave this blank, you may be interested in knowing this. If I leave this just set to Apache two slash h t docks, that means my domain and my i p address will continue to serve the same information the same set of files that's located in this HT Docks folder. Currently, I'm going a little bit out of order here, so we know we're listening on board 80. Let's set our server at men email address minus inquire RCR dot biz. The document root were telling Apache this is where you're going to serve files from when you get a certain type of request that certain type of request is going to be defined by the server name requesting the information or really the domain name that the request is coming from, in this case, a b gamma dot com server alias. I do want this active because I also want Apache to return the same information. If someone is calling www dot a b gamma dot com now personally, I use an HD access file, and I force all of my Www is to disappear. So that, it appears, is just the domain, or vice versa. I've actually done both in the past, but for now, if somebody sends a request to either one of these two, I want Apache returning whatever site I put in that place. Next up, the error log in the custom long, I'm not going to set these right now. I'm gonna leave them as they are. And the reason that makes sense for me, at least in this tutorial video, is because whenever you define a log here and you restart Apache, even if that log doesn't exist, it will be created. So for you, the easiest thing to do is maybe take something like, um, you know, your domain name and put that here so you'd have and just take out the dummy host that example and go for me, it be Abie Gamma. Now, again, I'm not doing that because it just create another set of server logs. And because the server has been started with ease authority there again. Go ahead and change these. I'm just not going to for the sake of argument and believe it or not, we're done with changing V. Hosts were done with changing this file, so I'm going to save it. We'll go to our FTP client and of course, I'll navigate to where that file is. Locally, I'll navigate to where the file belongs on my remote server, and I'll drop that file on the server again. You'll probably be asked whether you want to ah confirm or reject the overriding of the existing file. Go ahead and confirm it. Like I've said before, I have that setting turned off within file zilla. Okay, so we're gonna go now and restart the server. Remember how to do that pseudo Apache CTL restart And look at that. No airs this time Apaches telling me it understands everyplace. I'm trying to send my domains now. Nothing. You know, nothing spectacular here is goingto happen because look, I have a B gamma right here. When I refresh, we're still going to get the same page because I've told a began on the pole from HT docks . What we'd want to do now is go in and modify that, and by doing so, we can tell Ah, patchy. Anytime a request comes in from a B gamma, we should send it to a particular folder. And I'm gonna call that folder a big Emma dot com, as you might expect, so I'll save this upload again. Now you can do this all in one swoop. You don't have to keep saving and uploading, and it's not a bad idea to do it all at one time, because then you don't have to keep restarting your server. I can't type. There we go. All right, so every started the server. Ap cama dot com And look at that. A B Gamma is now hosted in its own location. We have the I P that still resolves to our standard welcome page, and then a b gamma dot com resolves to its own subdirectory, which again, behind the scenes. We've called a ba gamma dot com, but that's just the directory name. Since there's nothing in that directory, no files, no folders, no no images, no anything. The Apache Web server is simply creating an index, and you've probably seen this on the Web before. When you have gone Teoh any type of directory that does not have an index file, it will generate a listing. All right, so for now, that's that's it. What we'll do is we'll move on in the next video and talk about how we can established multiple domain names, and we even talk a little bit about what we could do with that I p address. We could go back into the main H T T P D configuration and set the default to, you know, maybe we want the I P to automatically default to a b gamma dot com. We could do that as well. All right, until the next video. Sit back and relax and enjoy the fact that you now have multiple websites running on one. Ah, patchy server. Even though it's not multiple domains yet, it's multiple sites. 14. Point more domains to your Lightsail Instance: No, I've just gone over to my domain registrar, and I've updated my DNS so that not only will a B gamma dot com point to my static i p address, as we see here, but also so that my website chase rats dot com, which has not propagated yet. So this won't work at the moment. But Chase ran's dot com waiting on that to propagate, and I've also gone over and made sure that part of my podcast. So I run a podcast called Multi New Media. It's a business technology podcast, and I took a sub domain training thought, multi new media dot com and it now point over do the I P address. So now we have a situation where not only can I power entire domains but sub domains and for instance, this will set you up for some very interesting scenarios because think about this for a moment. I empowering multi new media dot com on a different Amazon lightsail VPs account, and not just a different instance, but an actual different account and so safer load balancing or for any other reason. I wanted to power a sub domain elsewhere. I'm just demonstrating that I can do that very thing. So the pages of the same and you can see these two tamps have the same content. But one is at our i p address and the other is that training dot multimedia dot com. I'm still waiting on chase rounds to resolve. A lot of people are waiting on me to resolve, but we'll get there. I'll check that in a future video. All right, so we want to prepare for all of this. I'm going to go back into the ssh client. I'm gonna exit the Longs for just a moment. Good bearings of where I'm at and I'm gonna move into my HT docks folder. Now, I'm already in the Apache two directory, so I could just see the into HT docks. And here we go. If you were at the location where we started, right? Remember when you first log in your ssh? You're at home slash bit, NAMI. I guess it helps if I type CD before all of that doesn't home slash. But, NAMI, you're at this location where you have a assembling Tuapse hee docks and stack. From there, you could just see the right into Ah, your HD Docks folder. Either way, there we are. Let's put a clear command here to get more screen real estate. I'm gonna bring a list backup. We already have the a b gamma dot com directory created, and we can see it's empty. And when we resolved there, we get the index of an empty directory. But let's go back and start creating directories for these other sites I will create by using him. Kadir make directory and I'll create my next one and call it chase raz dot com. And just to show that you're not stock to the command line, what if I go back to FTP? I do need to navigate back up. I was in the configuration files, remember? So if I navigate, however, you've got to navigate back to HT docks. You're probably in a different location than I was, but once I navigate there, we can see that the Baby Gamma folder I created from the command line is there. The Chiefs rounds dot com folder that I created from the command line is also there. I can just create a folder from here. I don't have to do anything special, create directory. I'll call this one training dot multi new media dot com. That's a long name. We'll just say OK, here it is. We'll go back to the ssh and verify that it's there. I'm gonna use my hyphen, l command. And there it is. Training dot multimedia dot com. You can use command line. You can use FTP. Whatever your preferred mechanism is, we're going to create the virtual host entries for these in just a moment. But they do want to give a little bit more than just blank directories. I want to be able to tell where I'm at, so I'm going to change directory into a b gamma dot com. First, just pick any one of your sites that you're pointing to your aws instance, and we can see that there's nothing here. I gave the list. Command just went right back to the command prompt. So I'm gonna make a new file called index dot html and I'm going to use that nano editor so nano index dot html html There we go. Were in this lightweight editor. I'm just gonna put a very bad in short HTML document here, so I will time lapse to the point where I finish that, all right? And I'm very glad that I time lapse because you would be surprised how many mistakes you can make while you're recording and gets on your nerves a little bit. So I'm going to output this file now, in order to save or output, you can see at the bottom that my keyboard shortcut is control. Oh, so I'm gonna hit control. Oh, Nana is gonna ask what file name I want to write to. Yes, it's index dot html So hit enter. 10 lines were written and I will control X out of Nano back to the command line. You can see that at the bottom. I'm back now when I go to my browser and I refresh a b gamma now that have a web page there in the form of an HTML file. Look at that. Created an H one tank that gave the title wavy gamma dot com. I had put a title on the head. By the way, we see that up in the browser tab and I put one small paragraph Welcome to the A B gamma domain. Great. Wonderful. That doesn't impact what we see with our I p address That doesn't impact what we see with the training dot multimedia site. And that doesn't impact what we see with chase rats, and it looks like Chase rats has still not resolved. I'm hoping that happens before the next video, but for now, it should be fine. We're gonna go back in and I'm going to create a page for each of Chase Raz and training. I've got to tell you one thing I don't really want to dio is have to type all of this over and over and over and over again. So I'm gonna come over to code and I'm gonna use em it. I need to change this to an HTML file first, just going to use some in it to get this going. First of all, creating html five for chase rounds myself and then here do a body with an H one, I guess also. But a paragraph here. Great. So we'll see that. I guess I need a doctor. Save that you're going to create a new folder for my HTML files. I've just shown you here that you don't have to do all this to the command line. I don't want to. So I'm creating a directory structure that I could just ftp back and forth, and now I would do exactly that will come and find I'm finding the HTML files that I created, and then I will drop them in the appropriate folder. Let me go create one more for the training site for multi new media final save as instead of in changed around, creating new directory again, just showing we don't have to do this any particular way. Whatever your workflow is being really generic here for the sake of time, I upload this index file. Now. This point, there's no reason to go through and check each one domain by domain by domain because we haven't set up the V hosts. Let's do that right now. Go to http d v host dot com A copy and paste. We want, what to more First, we'll work on chase rats dot com. I'm actually going to take these logs off. I do suggest you use your due diligence and create files in your log folder for each of these. I really do suggest that, and I would do that if this weren't a training for the sake of time, but our second site is going to be training dot multi new media dot com. It's directory. It's stored in the server name will be training you dot com and the server alias. We don't actually need just over a lease in this case, so I will save they're ago. Keep hitting the wrong keyboard shortcut. I will save and we will upload. I have to navigate back to my configuration files, go to the extra configuration files and upload V hosts. Now you know what we need to do now? We need to restart Apache Sudo Apache CTL restart. Great. One court check of the domains. All right, The address from store default landing a big gamma still goes Davy Gamma Cheese. Raz still hasn't resolved taking forever here and then training dot multi new media dot com like that goes through our training dot multimedia dot com. So I'm gonna wait for chase rats to resolve, and then we'll come back to the next video and move on from there 15. Verify that all sites work: through the power of time and video editing. I've allowed all of the DNS settings. All of those recent changes to chase raz dot com and training dot multi new media dot com have given those time to resolve. So we want to walk through each of the sites of currently being powered by our one Amazon lightsail instance. So first I'm going to go into the instance itself and visit the static i p address. So I'm just gonna copy and paste that into a new tab. We still see our default application view. We can changes. We can move this. We can put our application here whatever we want to do. I can visit a b gamma dot com, which was the second side. I begin to power here on my lightsail. Instance. I then forwarded Chase ran's dot com with my typo and all remember that extra letter A that I didn't realize was there until I was editing the next entry, which was for training dot multi new media dot com Again, even though multi new media dot com is powered by a different VPs in a complete other Amazon account, it could be a complete different hosting provider. I've created the appropriate DNS records to forward it here to my Amazon instance in this particular training demo and this one instance is now powering all four of these websites. One question you may have is ok. Do I really want the I p address alone to be powering a different website than, let's say, a b gamma dot com. If that's my primary domain, wouldn't I want the I peed also power that primary? The answer may be yes. For you, it may be No. Maybe you want the i P address to be some type of landing page that gives you I don't know , a log an opportunity or redirects you to lightsail itself. The choice is yours. But if you did want to have the i p resolved to any one of these other domains, the fix is quite simple. What we would do is go back into our configuration files the versions that were editing We go into our extra folder http Devi hosts and we could do one of two things the 1st 1 or involves his v host file where we could say maybe I'm actually gonna host my main site. Not at some directory, but right in the HD docks file. This would be where our default welcome pages. Right now, I don't necessarily recommend that if you're running quite a number of sites. So the other thing we could do is we could go into the main Apache configuration H t t p d dot com and online's to 36 2 37 All scroll there. Very briefly. 2 36 and 2 37 We can change the default directory so we could say All right, I want my i p address to resolve to the A B gamma directory. Either one, The choice is yours. Now, I'm gonna take these out because I want my i p address to resolve to a different location, at least for this training ideo. But those are the two ways we'd solve for that problem. We either have a V host afforded to the regular HD Docks folder or we would take our H T t p D configuration and update it to take R i p to one of our hosted domains. That sounds really confusing, but again, watch the videos. Take a look at what I'm doing, Seeing it helps everything makes sense what they say. You know, a picture is worth 1000 words that's absolutely correct.