× {{alert.msg}} Never ask again
Receive New Tutorials
GET IT FREE

Nginx vs Apache

– {{showDate(postTime)}}

Codementor PHP expert mentor Chris Fidao is a PHP developer who runs Servers for Hackers, the newsletter about servers, for programmers.  

‘Chris recently joined us during Codementor Office hours and answered some of our viewers’ questions about Nginx.  Here is one of the questions he answered: Nginx v.s. Apache. 

The text below is a summary done by the Codementor team and may vary from the original video and if you see any issues, please let us know!


Nginx vs Apache

Nginx and Node.js can speed up performance and perhaps offer some advantages to concurrent connections.  How is it better or worse than Apache?

 

Nginx and Node.js are similar, since they both have a single or low number of processes. They’re also both asynchronous and evented, so their way of handling processes and requests is fundamentally different from Apache in that respect.

 

 

Apache will try to make new processes, new threads for every requests in every connection. Nginx, like Node.js, will not do that. It has few numbers of processes and will take new requests as they come, but because it’s asynchronous it can just start to process a request. In other words, if something is taking a long time, it can do something else (e.g. another request), and then come back to another one when something has finished happening.

 

If you’re familiar with coding in Node.js, you’d know that it has call backs, that something can happen and you don’t know when it’s finished until you get a call back from the thing that is finishing. Even though it doesn’t actually make your application faster, it is better for handling a high number of concurrent requests because it can handle operations in a non-blocking way. In other words, it doesn’t make you wait for a file operation or a network operation before it moves onto another pass. Therefore, in that respect I think it’s better than Apache. Apache can do a lot of stuff such as handle a lot of traffic, but Nginx and Node.js are a fun combination because they both have a really similar way of handling request responses and processing HTTP requests.


Other posts in this series with Chris Fidao:

Chris FidaoNeed Chris’s help? Book a 1-on-1 session!

View Chris’s Profile

or join us as an expert mentor!



Author
Chris Fidao
Chris Fidao
PHP/Python/DevOps
I'm a web (Python, PHP, Golang) developer, primarily working within the Laravel community. I run Servers for Hackers, the newsletter (12000+ subscribed) about servers, for programmers.
Hire the Author

Questions about this tutorial?  Get Live 1:1 help from PHP experts!
Samir Habib Zahmani
Samir Habib Zahmani
5.0
Senior Fullstack NodeJS Developer with 8 years of work experience.
So, you want to create a fancy website or web application. You *"embellished"* your resumé by saying you are a competent web developer, and now...
Hire this Expert
Nabil CHIHEB
Nabil CHIHEB
5.0
Full-stack developer focused on AI-powered SaaS solutions
Hi there! I'm a full-stack developer with expertise in building AI-powered SaaS solutions. I’ve worked on projects ranging from CRMs to APIs,...
Hire this Expert
comments powered by Disqus