Check out a free preview of the full Full Stack for Front-Ends Part 2 course:
The "http/2: Exercise" Lesson is part of the full, Full Stack for Front-Ends Part 2 course featured in this preview video. Here's what you'd learn in this lesson:

To illustrate how http/2 works, Jem enables and tests http/2 on his example server.

Get Unlimited Access Now

Transcript from the "http/2: Exercise" Lesson

[00:00:00]
>> Jem Young: So my list of lock, I'm gonna edit my size available, and add HB2 in there. So, sudo vi slash etc/nginx/sites-available/defaults.
>> Jem Young: Three, there we go. And send Http 2, cool. And, if you see the comments in here, managed by cert bot, these are the automated things that cert bot puts in.

[00:00:35] Remember, we said it does all this hand shaking and things for you. That's for you. So if you see these lines, generally try not to mess with it too much, but it should be okay. And so, I'm no gonna restart my server yet, because I wanna make sure this is working correctly.

[00:00:54] So if we say cats, because that's the one with all those on it.
>> Jem Young: It's cache from disk. So, let me disable cache, and let's make sure the cache is empty.
>> Jem Young: So that's pretty good, that's 1.12 seconds, that's not bad. Let's see if HP2 will speed this up a bit, because these are large files being sent in multiple chunks.

[00:01:19] And so, sanity check myself in Gen X dash t. Looks good. Sudo service nginx restart. All right. And, let's give this another whirl, all right, slightly faster, we shaved off maybe 0.2 seconds give or take. That is not bad, you're not going to see monumental gains using HB2, but it is marginally faster, and marginally faster is better than not faster at all, and it depends on what you are using.

[00:01:53] In this instance, when I was running it last night, I was able to shave off like 600 milliseconds. For this instance, I don't know why, but it's not going as fast. If you trying to tell the protocol in tools. You've said the protocol in there that says H2, this means it's running HB2.

[00:02:10] You may have to add things to the menu. Yeah you may have to add it to the menu if you don't see
>> Jem Young: But that's HTTP 2.
>> Jem Young: Nice, so that was faster, 800 milliseconds. That's about right.
>> Speaker 2: Support HTTP 2?
>> Jem Young: Yes. They do now. Good question though.

[00:02:33] All right. Questions? That was probably the easiest implementation we've done and we've paid off. Yeah, that's much faster now, 864.
>> Speaker 2: Where did you put your 443 see that, mine is doing an error
>> Jem Young: It is in the this box, so it is by the, it is within here, same virtual host configuration.

[00:03:03] It is probably at the bottom. Here you should see managed by Certbot as, I just saw a http2 in there.Yeah. I just want to. I don't think enough people believe. Some of them take out HB2 and reload. Just to make sure I'm right. Gonna try this again. 900, 700,

[00:03:30]
>> Jem Young: it's way faster now [SOUND] Two. Cool. All right. We are do well. You now have as modern a website as I know how to make it. Sounds where bluetooth and service workers. You are on the cutting edge right now and most websites are not even here so good job everybody.

[00:04:02] So now, yeah, I'm just a service H2 as you're saying the right particles at http1.1