Full Stack for Front End Engineers Introducting Nginx
This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v2 course.
Transcript from the "Introducting Nginx" Lesson
>> Jem Young: So now we're gonna move on to Nginx. We learned about operating systems, but we're already using that. So we don't have to go into too much detail about that. Nginx, pronounced engine x, when I first saw Nginx, I didn't know how to pronounce it, so I was like yeah, that ninx, nin jix.
[00:00:16] Yeah, it was one of those things like you can't pronounce until someone says it before you, so Nginx. Nginx is an extremely powerful, you can call it a server, but it's more of a reverse proxy. But it's a reverse proxy, mail server, and generic TCP/UDP server. Earlier we talked about the Internet runs on TCP/IP, transmission control protocol/Internet protocol.
[00:00:40] There's also such thing as UDP packets, and just, this is just nerd talk, the difference between TCP and UDP essentially is TCP is guaranteed to get there. So I send a bunch of packets, and then the server says I got those packets, send me some more, that's TCP.
[00:00:56] UDP is I just broadcast things and it may or may not get there. I have a great joke about UDP packets, but you guys probably wouldn't get it.
>> Speaker 2: Anyways, yeah.
>> Jem Young: Nobody? I can't hear the laughter around the world, but.
>> Speaker 2: I thought it was funny.
>> Jem Young: Thank you, thank you.
>> Speaker 2: I smiled, I didn't laugh, but I smiled.
>> Jem Young: Thank you, Mark, I appreciate that.
>> Speaker 2: [LAUGH]
>> Jem Young: But don't worry about UDP for now, that was just a fun joke. Let me slow down, people are still on A records.
>> Speaker 3: I think he's just looking for the advanced DNS tab.
>> Jem Young: Back on namecheap, if you go to your dashboard, Domain List, click Manage,
>> Jem Young: And then click Advanced DNS at the top.
>> Jem Young: [LAUGH] Okay, [LAUGH] that was a good joke. Use it at a conference, and some nerds will laugh. So mainly today, we're gonna be using Nginx as a reverse proxy.
[00:02:11] So what's a reverse proxy? But if you're a hacker or someone that pirates movies illegally or software, you probably are using some sort of proxy because otherwise, the ISPs would trace you right back to your house. So you're using a proxy. And what a proxy does is it takes a bunch of inputs, routes it through the proxy, and it sends it all out as one traffic.
[00:02:31] So in this case, it would be all of us using our different IP addresses going through a proxy, and all our traffic shows up as one IP address. We're all masked, and it goes out to the Internet. I hope somebody gets the Internet joke from-
>> Speaker 2: The Internet.
>> Jem Young: The IT crowd.
>> Speaker 2: It's so light.
>> Jem Young: [LAUGH] I'm looking at the chatroom to see if anybody's laughing. No one is laughing. All right, Samir got it, thank you. So that's what a proxy is. So a reverse proxy is reverse of that, it takes all the Internet traffic and it goes into the proxy.
[00:03:04] And in this case, we're gonna proxy all our traffic into Node, so that's why it's called a reverse proxy. Nginx just sits on top of your server, it intercepts all the requests, and it routes those requests appropriately. And in this case, Node is our main server.