Why use apache?

Why use apache?

It is even funnier to think of this situation though, because we know most people converted from apache to nginx. But not an issue we will see why you may want to use apache

A small justification by my side for doing this post. there are some people who would love stick to their past and I am providing them the reason why it's not the worst thing to use apache now.

So let's start then,

What is a web server

Let's say you opened my blog and you came to this post, what are the process that might have occured in the background while you visited the site?

On the first place once you type in the domain name (artisticprogrammer.com) then it will find the ip address that is related to the domain name and it say

Hey man can I have web page at the route / for serving my master. then my server goes on says sure man why not?

Then these two things will handshake and makes a channel between them and the content is served through it.

This is a simple analogy of how a website works,

  • The thing that is say "Hey man can I have web page at the route / for serving my master" is our browser, whenever you type a URL or click a new link this is what it does.
  • Then what is this "then my server goes on says sure man why not?". That is our web server which can be nginx or apache but there are other options available as well but this is the most used.

I hope you understand what a web server is, it is what communicates with the incoming requests and serves the resource based on the incoming requests.

That was smooth, let's now see what is nginx and apache in the first place. then we will be easily catch the point of why you might need to use nginx.

What is apache?

Now that we have seen what is a web server, let's understand what is apache?

So, right now let's say you made the requests and your browser has contacted the server, what happens between the moment that you sent the request to the moment that you recieved the response.

Once you send a request, it will process what is to be happened like for certain url certain type of html pages has to be sent and for other different one.

Some are dynamically generated and others are already a premade html file, that's the thing. The web server automatically realises the difference between them and make sures to serve the one it should serve not the unwanted things.

What apache does is that when you provide a folder of the things that you want to serve, let's take the example of a wordpress site.

So, when the request is made to the server it asks the php, "Hey bruh, what is the content that you want me to respond the dude with?"

Then php is automatically ran in the background process and this is done directly by apache, in the case of nginx it is different.

You don't need to run the php scripts seperately.

In simple terms, apache is a web server that you can use to serve a static or dynamic site without anything you have to do in the background, it is using a process driven approach, which means it creates a new thread for each request. It serves static content via file-based or folder structure and processes the dynamic processes by itself, it supports in all the operating system from unix to windows.

That is all that you have to know about apache but there are lot more to it but these are the important thing.

What is nginx?

No offence, on what I write here because in the case of performance between nginx and apache. Man, nginx murders apache like a serial killer.

Let me share some sources on the performance between nginx and apache.

Source DreamHost

Here you can see clearly, how brutally nginx murders apache here. When the no of connections at the same time increases the ram usage of apache is exponentially increasing

Whereas in the case of nginx you can clearly see the memory usage increases like a boat floating on a waveless sea, it stays the same almost.

Source DreamHost

So in this graph, red is the nginx and blue is the apache. Just keep that in mind and we can continue.

The more the no of requests per second the better it is at serving multiple users at the same time.

In the case of nginx it can't serve more than 1000 requests per second at any point of the graph.

But nginx on the other goes upto 12,000 requests per second and at the least it stays upto 8,000 requests per second which considering apache is so great.

The only reason you can reject nginx is because it is not as much as years old as apache, apache was released in 1995 April, nginx was released in 2004 October.

But the incredicle that happened to nginx in 2021 is that it got the most used and most popular web server in the web.

Nginx wins the most popular web framework by 2% in www.

There is no more reasons as well I would say why not you can use nginx.

Why use apache even after all these things?

That's a little complicated and too much opiniated on why still choose apache, I am gonna share why one might still choose apache,

  • Complete support for all os including windows
  • Processes all the dynamic content by itself (the web server)
  • 60 Official dynamic modules that you can use to customize
  • More flexible than nginx in the case of dynamic serving
  • Lots of support and way lots of resources for debugging since it is available for a long term.

I don't see any more reasons to go after apache and these reasons that I have mentioned are completely biased ones.

Only if you use a windows operating system for serving sites, which really is not the best way to do it but you may have your own reasons.

But I prefer to always go after nginx because it gives you the edge over apache in the case of performance.

Conclusion

The reasons why someone might choose apache is really upon their biased opinions not because of a proper reason except in the case of windows alone.

If you plan to serve a slightly bigger scale applications on a server that is of less resource then you should always at any cost go after nginx

But if you are just starting out and the course or the curriculum that you are learning from is using apache then use apache.

If you are learning social engineering or something in the field of hacking most people prefer apache because it is pre installed with kali-linux and also it is simpler to use.

Always choose nginx if performance is your important factor or else you can use apache if you want to use it because of the reason that I mention