As our version one point nine point five.
Engine X includes a new HTP 2 module.
And then this lesson we'll take a look at how to enable this module.
After first discussing what htb too is and why it's worth upgrading from the age old age TTP one point
one first off HTP 2 is a binary protocol where h.t. TB One is a textual protocol.
Binary data or ones and zeros is a far more compact way of transferring data.
And it greatly reduces the chance of errors during data transfer.
Secondly HTP to compress this response headers which again reduces transfer time then the single most
important feature for performance is the fact that HTP 2 uses persistent connections and those persistent
connections are also multiplexed meaning that multiple assets such as stylesheets scripts and xceedium
l can be combined into a single stream of binary data and transmitted over a single connection.
A cheatee be one of course requiring a dedicated connection for each resource but we'll discuss this
in more detail in a second.
Finally HTP too can perform a server push meaning that the client the browser can be informed if assets
such as scripts images or stylesheets along with the initial request for the page will look at this
in the next lesson however.
Okay let's see how exactly connections are opened using htb one compare to the persistent multi blixt
Connections of HTP to remember that opening a new connection is a time consuming process which is why
developers concatenate multiple javascript or see SS files into single files.
Opening a connection requires a handshake between the client and the server.
And for this to happen headers need to be passed on both ends each time.
There is also a limit to how many concurrent connections a browser can open to a particular domain at
once.
Making these connections even more valuable when trying to maximize client side performance.
In this diagram.
Then let's see how many connections it takes between the client and the server for a basic h.t. AML
page with a linked style sheet and a linked script first HTC One the client requests indexed on a chart
here mayol which opens a new connection to the server and if everything goes right the server responds
with the HD malcontent.
That's one connection the browser now has to process that h.t. email data.
After receiving it from which it can then identify linked resources required by their h.t. email page.
For example two files namely style dotsie assess and script Dodger Es.
So again the browser opens a new connection to the server and requests style dotsie says To which the
server response with the C Ss data that's two connections and the same for script.
RJ es remember h t t be one point one uses simplex streaming.
So one connection handles one request.
That means we use three connections in total to load a very simple web page.
Of course most modern websites will require multiple script files style sheets and images so we can
easily be using 15 plus connections for such a page.
And at that point connection limits in the browser will start coming into effect as well meaning that
some new connections might have to wait for others to be closed first.
All in all this is just not an ideal way of transferring data.
And that's where h.t. to be to comes to the rescue.
That same scenario using hgt be to now looks like this.
The client requests indexed not h.t. AML and the server responds with the data.
The browser Now process their data and then over the same persistent connection requests both style
dotsie assess and script Dodger here as to which the server sends a multiplex stream containing the
data for both these files.
So this time round we only use the single connection for all this to happen.
Compared to the three connections over HTP one.
OK with that covered.
See how to enable and configure hgt be to on engine x.
Very importantly a requirement of htb DO IS S S L or H T T P S meaning before we are able to use H T
T P to will also have to configure the most basic SSL connection which will do.
In this lesson after adding the hgt to module.
I'll clean up this configuration from the previous lesson.
Remove all the fast cji Cache directives.
Not necessary but just less cluttered.
And save.
Then Step 1 is going to be adding the HTP to module to our install.
We've seen how to add modules before so I'll quickly go over this move into that original source code
directory.
Get the current bold configuration with engine X and a capital V flag.
I'll copy that and now to see the flag needed for adding htb to to our bold in the source code directory
run configure with the help flag.
So listing all the available configuration flags faltering with grep for hgt B underscore version 2
they're worth hgt P.
Version 2 module so configure again in the source directory pasting the current configuration flags
as we copied it from a year and a pend.
That new module flag with H dtp v to module.
I mentioned that we also need SSL to be able to use HTP too but that's already been added here.
Just be aware of that SSL underscore module enter asked forward through this done compile with make
this being the really long one so fast forward again.
And once that completes make install.
That's all done so restart engine eggs for good measure a reload will be fine but I prefer restart after
rebuilding check.
Everything is fine.
And all good before enabling SSL and h.t. to be too.
Let's see what our server response looks like at the moment.
Just to have something to compare to over to the browser.
I have the demo site indexed out h.t. a melt page opening so launch the developer tools open the network
tab which will be more or less the same for any other browser you use.
Reload again.
And if we inspect this indexed outraged the email response we see no SSL so plain hgt B.
And HTP version one point one.
As expected.
So let's enable hgt be to with SSL and check back we'll configure it first being requirement for h.t.
to be true and what we're going to need is an SSL certificate for a production website.
You'll of course want some legitimate certificates from a vendor or a service such as let's encrypt.
But for the purposes of this lesson all generate a self signed certificate and private key perfectly
fine for testing and development.
I'll move back to my home directory saeedi and to keep things tidy.
I'll store the key and the certificate in this engine X directory or more specifically a new directory
in the engine next Directory.
S s l create the new Directory make DIR slash e t c slash engine X slash s s l.
And there it is.
So with the directory there let's generate these test certificates using the open SSL command line tools.
No need to really understand what is happening here.
But I'll give a brief rundown anyway.
Open SSL request.
Ari.
Q To request a new certificate signing x 5 0 9 being the cert standard we're requesting days being how
long to make this certificate valid for.
I'll just make this 10 days note which allows us to leave out a pass phrase or password for the key
file new key meaning generate a new private key for the signing request at the same time that nuki being
off type are s a.
With a length of two thousand and forty eight bytes writing the key out to slash see slash engine X
slash SSL slash self dot key.
So in that new SSL directory we created and out being where to write the this is difficult to also slash
ebc slash engine X s s l self-taught c r t again.
No need to really understand this.
Just a convenient way to create this private key.
An artist's certificate.
Enter a private key get created and then we get a few questions for the signing request.
Not that important being a test certificate.
Country Code province city organization steck academy a TV business section a name and an email address.
Done.
List the contents of that SSL the rectory to check our files accessed and there it is a private key
and a self signed SSL certificate.
So with that let's first enable SSL or htb s in the configuration file.
Change the listen directive to.
Now listen on port 4 4 3 being the standard HTC P board for SSL encrypted connections and add s s l
referring to the SSL module being used for this.
Listen DirecTV configure the location to that SSL certificate we generated again in that HTP context
SSL so difficult out ATC slash engine X slash SSL self dot c r t and in combination with the certificate
tell engine X where to find the signing key SSL certificate key slash EDC slash engine X slash SSL self
dot key.
That's all we need for basic SSL so safe reload the configuration.
Back to the browser.
Change this to htb s.
Enter which presents us with this warning as we are using self science certificates.
I'll add an exception.
This might look different depending on your browser but nonetheless just allow the connection once and
the browser will remember on firm.
And indexed not HDMI loads over.
H T T P S indicated with the lock icon up here in the U R L and down here in the network inspector but
still hgt be one point one.
So let's enable it she dippie to this being really straight forward now.
I'll add on to this.
Listen DirecTV HTP to again referring to the module that should be used in conjunction with any requests
on the sport save and reload engine x.
Reload indexed not h.t. email in the browser and this time when I inspect this indexed I'd aged hicham
old response we see htb version 2 meaning our site is now being served entirely over HTP to where support
it which is all major browsers should hgt be to not be supported.
However I'll copy this.
You are able to demonstrate to curl request for this displaying the headers only and a K flag to allow
that insecure self signed to difficult enter.
And we get automatic fall back to HDB one.
So nothing to worry about there.
That wraps up enabling htb too.
And whilst we also saw how to enable s s l will cover that in more detail in the security section of
this course in the next list we will take a quick look at a basic h.t. dp push implementation.