× {{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!

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!
Adam Dorling
Adam Dorling
5.0
Full Stack Web Developer of 6 years, Programmer of 8 years
I've been a Web Developer of 6 years, working on websites in both Chinese and English. I primarily work with PHP/Laravel5, Javascript, SCSS, MySQL...
Hire this Expert
Ricardo
Ricardo
5.0
Senior Software Engineer
Software engineer with 13+ years of professional experience. If you have a problem feel free to contact me, I always go above and beyond to try to...
Hire this Expert

Or Become a Codementor!

Live 1:1 help from expert developers

Codementor is your live 1:1 expert mentor helping you in real time.

comments powered by Disqus
Codementor is your live 1:1 expert helping you in real time