If you're trying to make sense of web application architecture, you've no doubt heard of Apache and Nginx.
They're both free open source projects, very commonly used as HTTP and reverse proxy servers.
Let's unpack those definitions a little bit.
Say I'm sitting at home with a web browser going to my favorite website, ibm.com, of course!
It's easy to imagine that my browser is talking to the IBM server and asking for the right web page.
That's the request right there.
Now, in this case, let's say it's asking for cloud security.
And the web server goes around and digs through its data to put that page together and then ships it back to me.
So here's the the resulting web page nicely rendered in my browser so I can learn all about hybrid multi-cloud security solutions.
A perfect afternoon activity.
Now, this is an example of a simple web server--software which can accept HTTP connections
and map them to documents or images or other resources and then return them to the requester.
That's me, or at least my web browser.
And this may have been an accurate diagram back in the early 2000s,
but most public-facing websites get so much traffic that it makes sense to have a couple of web servers back here serving that content.
And they're all capable of delivering the same content.
And then this thing becomes a load balancer upfront to make sure that no one server gets too busy.
Some load balancers operate as layer 4 load balancers, and that means that they work at the transport level, and they simply route the request to each available server.
So they can handle DNS, mail, TCP and UDP traffic.
Now, I personally like my load balancers the way I like my bean dip: 7 layer.
And well, Apache and Nginx are often used as 7 layer load balancers, operating the application layer, specifically HTTP.
So this specific request comes in, it hits the proxy server up front
and it goes and initiates its own connection with the server, or the servers on the private network, to fulfill the request.
So we're talking to those servers by proxy.
Now, this gives us several key advantages.
So let's take a look at some of those.
And the first one is all about load balancing.
And I think it's the most obvious advantage because we can route the requests to any number of the servers now,
we're no longer constricted to the performance of a single server-- we can send it to the one that is least busy.
Number 2 is security.
Now, we're never letting the outside world know what's back here at all.
All they ever see is this, the reverse proxy.
Even though it's just reaching out and tasking those servers with the work to the requester, the web browser, it looks like it's all coming from right here.
It takes all the credit, which is kind of rude, now that I think about it, but we'll let it slide.
Now, although it sees the same request over and over again, if that is for a static non-dynamic resource,
let's say a very popular image is at the top of every web page, it can do something called caching.
So it can cache that resource and then it can serve it up on its own, saving time and network throughput.
So at least it's trying to help there.
And speaking of reducing network throughput, it can also optimize compression, and that is benefit number 4.
And that compression is specifically between itself and the client, decreasing load times.
And it can also handle SSL connections out to the web, allowing servers on a private protected network to communicate in plain text,
which can dramatically speed up some applications.
Now, typically we recommend employing encryption everywhere, but in some cases it's not practical and it's not needed.
So I just wanted to put that disclaimer out there so I don't get yelled at.
Okay okay, now, the point here, we came here to talk about Apache and we came here to talk about and Nginx.
And they-- Apache and Nginx --they do all this.
The difference to know is that Apache, well, Apache came first.
And it's been around for a long time.
We're talking pre-2000 here.
And it started out as a basic web server, which has been extended over time with the use of modules.
So we want to enable the mod_proxy and mod_http modules to give it reverse proxy capabilities.
It works, it performs well, and it's got a ton of functionality besides-- and in addition to --being a web or reverse proxy server.
But that, that wasn't good enough for Igor Sysoev, who released Nginx in 2004 with the explicit goal of outperforming Apache.
Nothing like having a target painting on your back, huh?
So suffice to say, Nginx does outperform Apache as a simple web server and proxy server.
It is without question fast.
It also has a very simple configuration, and that makes it very easy to handle large volumes of transactions, especially when it comes to simple static files.
When we start getting into dynamic content, because Apache has its roots as an extensible server, that's where it really holds an edge.
There's just a lot more you can do with it, albeit at the expense of speed in some cases.
And I think it's also important to note here that we're talking about HTTP traffic.
And it's not just web pages like here, but any HTTP traffic, including all of those REST calls.
Cause you are you did watch my video about REST calls, right?
Well, they're handling these REST calls which power just about every web and mobile app there is.
And right now Nginx is a bit more popular in the container space.
So it enjoys a bit of a popularity boost from all those containerized solutions.
But as we've seen, this is a hotly contested space.
And they don't need to fight-- they can be friends!
It's entirely possible to have Nginx acting as your reverse proxy with several Apache web servers behind it, or vice versa.
The fundamentals are largely the same.
It really does come down to what fits best into your environment.
So whichever solution you go with, you will enjoy a whole host of features that will keep your web data flowing quickly, safely and reliably.
If you have any questions, please drop us a line below.
And if you want to see more videos like this in the future, please Like and Subscribe.
Thanks for watching.