OK, so it is time to hook our application up to the Web server.
Now, you may not be aware of this, but our Web servers are currently running.
And if I copy the IP address of my my server, my temp server that I've been working with right along
and just go there by pasting the IP address in.
We actually have it running and it gives us some instructions on how to configure it.
But I'm going to ignore those constructions and use something that I find quite helpful and a little
more useful.
So to get this running, let's connect to our our virtual server.
So S.H. username at IP address and that gets me in there.
Type in my password and I'm going to clear the screen and go to ETSI and then Katti, which was installed
for us when we installed Ketti.
And inside of there we have a Cadie file.
And if I look at that, we have all kinds of instructions which are just really helpful.
But all this is doing right now is serving whatever it finds in this directory, user share, Cadie.
So that is the content that's being served and it runs that as a file server.
So what I'm going to do is quit out of this and I will Souto move Cadie file to Cadie, file dot DST
for distribution, type in my password, and then I will make my own Cati file pseudo ovie cati file
and it has to be named exactly that or Cadie won't find it.
And in this file I'm going to put a few things in.
The first thing I'm going to do is put an opening curly bracket and then put email and some email address.
I'll put admin here dot com.
You put your email address in there and you'll be fine.
And then I'll close that curly bracket and then I'll open an open something called static.
And this is a root that Cadie will use every time it finds something.
Whenever you tell me I told it to use the director of static open a curly bracket tab in and I'll put
at Statik, open a curly bracket tab in a couple of times, file on the next line path.
Start out.
Icko, these are things that I want it to match.
Stardust's CSFs start on J.
S Star Dot G.F. Star Dot.
Just an idea.
Jass GPG Star Dot jpeg in case the file is named that way start PMG Stadt SBG Stadt WAF for Fort's and
start JSON for JSON files and then I will close that curly bracket
and on the next line I'll add a header that says for the static root for things that match those files
with those extensions.
Here's what I want you to do.
Cache control with a capital C max age will equal five hundred and eighteen four zero zero zero and
then I'll close my curly curly brackets for the static root.
So all that's doing is saying anytime you encounter anything.
A file that ends with Icko CSFs, I see a Mr. Dot there, so I better put a dot before the access.
And the J.S..
And the rest of them look OK.
Cash, those cash, those four or five hundred and eighteen or five million, one hundred and eighty
four thousand seconds, which is a long time.
So it won't force the browser to reload those files unless the user reloads the page.
And then we're going to create another route called security and it's going to follow the same syntax.
Actually, in this one, I was going to make it simpler.
I'll go with heter and I'll say I'll put a comment in enable Høst, which just forces browsers to use
the SSL certificate in it.
If somebody hijacks your domain and doesn't have an SSL certificate, it won't even load.
So we'll put in strict transport
security, max dash age.
And again, I'll make this really long.
Three one five three six zero.
Zero zero, and then I will put another comment in disabled clients from sniffing media type and I'll
put it in the header x dash content, dash type dash options, no sniff.
And then finally, keep refer
for data off of HDP connections, these are just good basic security protocols, referrer policy, no
Dasch refer
referrer when downgrade.
And clothes that hair and clothes the security, and then I'm going to say to Cadie, look inside a
directory, which doesn't exist yet, but we will in a minute import confort D slash star dot com.
And then I will save this and I'll close it in a second.
But I'll tell you what this is doing.
So all I'm doing is setting up two things that I can refer to static and security.
And then I'm telling Cadie to look inside the directory named Confort D in the current directory and
find any file that ends in C, O and F and load that also as part of this Cadie file.
OK, so let's save and quit this and then create the directory pseudo make dear confort D and then go
into the better and put an eye on the end of it.
Move pseudo move.
Can't DIY to cornfed D.
That's better.
Go into the config directory and let's create a new file and I will call one or create one called Pseudo
Vij.
I'll call it Bullecourt.
OK, now this is a file and inside of this I need to first of all have some name for this server.
Now, if you control the domain, you can go and set up the domain that you control to point to this
server and give it some name, whatever dot com.
I don't want to do that right now because it doesn't matter what the name is, it just matters that
the name exists.
So I'm going to go back to Lineout or Lynard, open this up and find the name of this actual droplet,
or it was the droplet on Digital Ocean.
It's called a little note here.
So the name of this is right here.
I'm going to copy that name and I'll use that as the name of my server.
OK, so I'll go back to my file and I will hit I to insert and paste in that name.
And that's actually a registered domain name that I can get to the server from.
And then I'll put curly brackets, same as I did before.
And what I want to do is to put a few directive's into this, this virtual host.
The way I'm doing it, I can setup as many hosts as I want all to be served by Katti and I might have
more than one go application that I want to serve off of this server.
So this is a really convenient way to do it.
So first line gives the name of the server, which I just copied from L.A. and then an open curly bracket,
and then I'm going to put a few directive's in here in Code Z, SAGD and GCIB, which will compress
the files and make the site run much more quickly.
And then on the next line, I will say import static, which is the route we just set up in The Cafferty
File a minute ago, and then I'll import security as well.
So all of the directives that exist in the static and security are now part of this server.
And then I create a log file because it's always nice to have a log file.
So log open a curly bracket and then I'll say output to a file and I'm going to put this in via WW W
and I'll call this booking or just book.
Slash logs, slash caddy, access dot, look on the next line, I'll specify the format of that file
format, single field common underscore log, but a better still field, right?
Single field, common log, OK, and on the next line, I'll close those curly brackets for the log
directive and then I will actually point this application or this this this website for Cadie to my
application.
And if you recall, we have our application listening on Port Eighty-eight, but you can't get to Port
80 through our firewall.
So all I'm going to do is reverse proxy and the command is actually reverse underscore proxy.
And I want to reverse proxy from this site to HTP Collins localhost Colen AT&T and then close this file
off.
And that's all I should have to do for the Katti configuration.
So let's just make sure we get this right in code Z.
Steed GCIB import static import security output file.
That all looks good to me, so now I need to go create that directory for logs and move the application
to var W-W book.
So let's do that, we'll save this, go to our W-W and there isn't it.
So let's slash ver ls pseudo make dear w ww pseudo sete or just cd b.w. and what's in my home directory.
I have my bookings directory so I want that to be here and I want it to be named book.
So pseudo move from my home directory.
Looking's to here but call it book and there it is.
Now let's go inside of book and we need to have a log's directory here pseudo right.
I could actually just do no pseudo here because I believe I own these files.
I do mctear.
Logs and then just to make sure that things will work properly, I'll say Chowan seven seven seven logs
just to make it readable, readable Chown Pseudo Chown 777 are not Chown Shamos mod for change mode.
Make this readable by everyone for logs and they're so now I should be able to.
First of all, let's try reloading Cadie pseudo service Cadie restart, make sure it starts OK and pseudo
service katti status.
OK, looks like it's running good.
OK, so let's quit out of that control see.
And let's start our application just to see if it runs.
So once again let's see what our directives are.
Um bookings.
Dasch H so I need to run bookings.
Dasch db name equals book dash db pass equals password which is the word that I used.
Dash db user equals book and that should start.
OK, so now I'm going to go and try to hit that application name right here.
I'll copy this again to make sure I have it on my clipboard.
Hit this server name and it might take a couple of tries while it goes and gets an SSL certificate,
but let's try it.
And there it is and look at that, it has a security certificate and I should be able to log in and
do everything properly.
Let's just try a few pages, make sure it works.
It looks great.
So this is absolutely doing precisely what I want it to do.
So the last step, which will do in the next lecture is to change it so that I don't have to go manually
start the application, because the minute I close this terminal window, the application will stop
and nobody can get anywhere.
So I need some means of having the application.
Ah, go applications start automatically, whether the servers rebooted or not, and to make sure that
the application stays up and running.
And we'll do that with a supervisor script and that'll be our last step and we'll take care of that
in the next lecture.