I have currently installed Apache on my 12.04 32-bit Ubuntu server, but I'm interested into switching to Nginx. I have read a number of comparisons and reviews, where Nginx is faster than Apache serving static content, but these don't cover PHP performance.
Here is my question: How does Nginx compare to Apache regarding performance of PHP processing? Is Nginx also faster for PHP?
Best Answer
Here is a comparison between Apache and Nginx listing some advantages and disadvantages.
Apache, by contrast, approaches large numbers of requests by spinning off more processes to handle them, typically consuming a lot of RAM as it does so. And sometimes Apache gets a little anxious about the size of its repast. Apache is available from the Ubuntu package repositories with a quick
sudo apt-get install apache2
.Nginx (pronounced "engine-ex") is a lightweight Web server with a reputation for speed, speed, speed. It differs from Apache in a fundamental way—Apache is a process- and thread-driven application, but Nginx is event-driven. The practical effect of this design difference is that a small number of Nginx "worker" processes can plow through enormous stacks of requests without waiting on each other and without synchronizing; they just "close their eyes" and eat the proverbial elephant as fast as they can, one bite at a time.
The difference is summed up succinctly in a quote by Chris Lea on the Why Use Nginx? page: "Apache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache."
When you compare Nginx vs. Apache, both are open source software, and both camps have a community of vocal advocates. Nginx is available from the Ubuntu package repositories with a quick
sudo apt-get install Nginx
.In the end, both Nginx and Apache web servers are solid solutions although each has their fortes in given situations. Nginx’s main strengths include serving up static web pages quickly, and light consumption of memory and hardware resources. Apache is the established and versatile workhorse, with abundant module availability and documentation. Depending on your business needs and technical requirements, one or the other, or even a combination of the two, may be right for you.
Hope that this helps.
Source:Lee Hutchinson & Lukasz Kujawa