How to Choose a Linux Web Server: Nginx vs. Apache

         The rapid rise of Nginx and the steady decline of Apache’s share in the web server market have sparked considerable speculation. Many in the industry believe this trend will make the choice between the two clearer in new deployment workflows. In fact, I recently tackled a fairly large server setup project and ultimately chose Nginx as my workhorse — but was it the right choice?

As things stand, the long-standing love affair between the internet and Apache seems to be fraying, signaling that the king which has ruled this domain for over a decade is finally showing signs of fatigue. While Apache still powers the majority of websites globally, Nginx (engine-x) has been steadily eating into its market share over the past few years.

 

 

With its event-driven design, Nginx has surpassed Apache’s process-driven architecture, making it a highly popular solution better suited to today’s computer hardware. In practice, Nginx can support more concurrent clients and deliver higher data throughput than Apache on identical hardware under certain conditions. However, this shouldn’t be the sole criterion; we should also consider exactly what we intend to do with the server.
    Nginx excels at handling static content, performing more efficiently than Apache, though Apache’s static content speed is no slouch either. Static content is the simplest task for any web server, which is why high-traffic sites often use more complex backend systems to generate static content, thereby meeting user demands faster and more comprehensively. The involvement of PHP, however, adds more complexity to this process.

The most critical question when choosing a web server setup is clarifying how we intend to use the server. If we only need to support a single site, and the server runs a dedicated database system acting purely as a web server, then choosing Nginx is undoubtedly the smarter move — after all, Nginx handles traffic better than Apache. Furthermore, Nginx offers configuration features that make scaling out easier than with Apache when necessary, which is another advantage. But if we plan to host multiple sites and numerous applications on this server, such as several WordPress sites, the answer becomes less clear-cut. In such scenarios, the performance bottleneck is more likely PHP rather than the specific web server choice.

Faced with this, you might think: well, if PHP is a challenge for both web servers, and Nginx is faster at serving static files, why not just go with Nginx? The dilemma exists because Apache has its own unique strengths. It is a mature platform with extensive support across the Linux ecosystem. Many features that work out-of-the-box with Apache might require careful research and configuration in Nginx. Several control panels and automated configuration tools are still unavailable for Nginx, and your technical team may be more familiar with Apache and more adept at diagnosing its issues. These are significant advantages that warrant careful consideration.

In most cases, the performance gains offered by Nginx are negligible. Unless you are hosting billions of massive sites, the traffic advantage rarely materializes. You should prioritize your actual requirements and existing skill sets. If you want to experiment with a new technology on your personal blog as a learning exercise, you are free to choose any platform you like. If you are setting up a hosting server or a business-critical application, however, it’s better to evaluate your options more carefully. Simply handing all the work over to Nginx purely for speed is a judgment call that can easily lead to serious consequences.

Ultimately, the best strategy is to combine different technologies rather than relying on a single web server platform. Sites handling massive traffic require a multi-tiered architecture, where the web server is just one small part of this comprehensive system. Most ordinary sites should prioritize solutions their technical staff are more familiar with and compare specific performance aspects that truly matter. Apache remains an excellent engine and enjoys sustained popularity. As it continues to evolve and mature, Nginx will also gradually improve — perhaps even surpassing Apache within the next five years.

To choose between the two, the correct answer is “it depends.” If you plan to host very common site scenarios like WordPress, I believe both solutions deliver excellent performance. Using Nginx to cache your site content (recommended) can improve performance, but this means sacrificing Apache’s advantages in out-of-the-box usability, compatibility, and a gentler learning curve. If you need to run PHP applications, adopting an opcode caching mechanism like APC yields a far greater performance boost than agonizing between the two web servers. My take is that Nginx is not a magic cure-all. Choosing it simply because Apache is old and doesn’t seem as cool as the new kid on the block might very well land you in hot water.

English: http://www.itworld.com/consumerization-it/421347/choosing-linux-web-server-nginx-vs-apache?source=ITWNLE_nlt_today_2014-06-03

Leave a Comment

Your email address will not be published.