Before we can go ahead and configure our virtual hosts file we need to make a directory for each domain
that we want to host on this server to do so we'll use the following command.
This is the make directory command and we need to replace.
Example dot com with our first domain.
Once you've done that go ahead and press enter.
Now we'll need to change the permissions of this directory as well.
But we'll do that in a moment before we do that.
Let's go ahead and make the directory for our second domain as well so that we at least we have our
folders created
and press enter.
So one easy way to administer folders rather than typing in command lines and doing it that way.
Is if you have an agent.
So for example file Zilah or anything like that.
It's a lot easier to just connect to your web server and administer files and folders that way.
So I'm going to go ahead and launch file.
And I'm going to go into my site manager.
Now I already have this server configured here is test.
If you don't just click new site what you're going to select the s FGP method and make sure you don't
select FTB select as FTB for the hostname.
You're gonna need your floating IP address.
So go back to Digital Ocean and just copy this IP address your
and enter your IP address next to the host Leavell for log on type select normal.
You're going to log in as root user and type in your password that you selected when you initially deployed
your droplet and then quick connect
OK you're going to receive a messages saying the servers host he is unknown.
Just go ahead and click OK.
Now you're going to scroll up.
So just double click this folder here.
And once you've gone up one directory you're going to go in the var directory.
And then the w w w directory.
So as you can see we have the two folders we just created this is the first domain and the second domain
and what we're going to do is we're going to reset the permissions for both of these domains so to do
that right click on each domain and go to file permissions.
Make sure that it's 7 5:5.
In this case it is.
So there's nothing left to change their And the second one should be the same.
7 5 5.
OK that's perfect.
Now what we're going to do is create an HMO folder inside each one of these directories.
So when you click on this first directory and I'm going to right click and select Create directory type
in each DML.
Just check to make sure that the file permissions are correct.
Type in 7 5 5 and press OK now go up go into the second domain directory and create a folder called
HDMI again and again set the file permissions.
OK so perfect we now have our two domains.
If you have other domains you'd like to add you can go ahead and repeat that step for each domain that
you'd like hosted on the server.
Now if you do have a number of domains here you're probably going to just want to set the permissions
for the entire w w w directory for now and then as you build your web content you can always set up
individual file and folder permissions separately.
But if you're dealing with a lot of domains just right click on your w WW folder go to file permissions
and what you can do is place a checkmark in this box your recurse into subdirectories.
So what will happen there is every single folder inside the w w w directory will also have the same
permissions that you establish here.
So go ahead and click OK.
And so that yeah that's a lot a lot faster if you're dealing with many different domains.
So here we are back in terminal and the next thing we need to do here is create the default indexed
h DML file that will load when somebody visits each domain.
So each domain would need its own separate index dot each DML file which is relevant to that domain.
So we can go ahead and create this file in nano text editor.
So just paste in the following command here.
Make sure that you replace example dot com with your domain name.
Will do one domain at a time so you can start with the first one and then move onto the second and press
enter.
Now inside this file you'll need to paste in the following code.
So it's just a basic DML page and the title for the first page is.
Welcome to domain 1.
Now you can replace domain one with your actual domain name
and in the body.
We're just going to have success domain one is configured correctly and you want to save this file by
pressing control X type Y if the prompt and press enter.
Now let's go ahead and create the index dot h d m l file for our second domain so use nano again.
All you need to do is change your domain name in the command to your second domain
and press enter.
Be careful not to be careful to avoid any typos any spelling mistakes in the domain names or folder
names will cause issues later on.
So press enter and just paste again.
And this time I'm going to put.
Welcome to domain to
and success domain to is configured correctly.
Now save this file.
Enter OK and we'll see you in the next lecture.