1月 222017
 

By: Ryan Frankel Posted: May 9, 2016

 

TL; DR: We assess two of the most popular web servers: NGINX and Apache, on six key points of comparison (performance for static vs. dynamic content, OS support, security, flexibility, documentation, and support). We’ll find that the two are worthy competitors, but Apache’s .htaccess file makes it particularly appealing to shared hosting customers. Meanwhile, NGINX reigns supreme for dynamic content support, and due in part to its more advanced feature offerings, is most popularly used by VPS and dedicated hosting users. Finally, we’ll go over our recommendations for hosting your next web app project.

There was a time (~late 90s-2011) when the Apache web server served around 60 percent — and at times even more — of the world’s websites. That percentage has since fallen below 35 and is still dropping at quite a significant rate. Meanwhile, Microsoft’s IIS web server has held a somewhat steady, slightly increasing, share of the market, reaching 30 percent today. Third place is held by a competitor called NGINX (pronounced “engine-x”), which currently serves around 16 percent of all sites, and that rate is steadily growing by about one percent each year.

I’ll note that some web surveyors place the market shares of Apache and NGINX much higher, considering IIS a lesser competitor. Reality likely resides somewhere in the middle, but the overall trends are clear. Considering only the busiest sites on the Web, Apache holds about 46 percent of the market share, but that portion drops by about four percent annually; NGINX holds a strong second place with 24 percent of the market share and is growing at a rate of about three percent each year. Clearly NGINX is enticing the world’s biggest web properties with something! Continue reading »

1月 222017
 
January 28, 2015

Introduction

Apache and Nginx are the two most common open source web servers in the world. Together, they are responsible for serving over 50% of traffic on the internet. Both solutions are capable of handling diverse workloads and working with other software to provide a complete web stack.

While Apache and Nginx share many qualities, they should not be thought of as entirely interchangeable. Each excels in its own way and it is important to understand the situations where you may need to reevaluate your web server of choice. This article will be devoted to a discussion of how each server stacks up in various areas. Continue reading »

9月 152014
 

最近将Nginx从1.60升级到1.61,然后发现php不能解析了。
切换回Apache,工作正常,说明不是php5-fpm的问题,而确实是nginx出问题了。

生产环境,若要稳定,还是apache比较好,很多年了从来没有出现类似的问题。
但是nginx的性能是有目共睹的。

回到正题,google了一下,解决办法如下: Continue reading »

6月 172014
 

Time is money. This somewhat shallow and overused saying fits perfectly well into any on-line business. Users are impatient and every millisecond brings them closer to leaving your website.

If you’ve ever been trying to squeeze more out of hardware you must have come across Nginx (engine x). Nginx usually appears in context of PHP-FPM (FastCGI Process Manager) and APC (Alternative PHP Cache). This setup is often pitched to be the ultimate combo for a web server but what that really means? How much faster a PHP application is going to be on a different web server? I had to check it and the answer as often is – that depends.

I benchmarked three different types of PHP software:

– Large application based on Zend Framework 1
– Small PHP script
– WordPress

The software was hosted on Amazon EC2 large instance. All benchmarks were run from EC2 Tiny instance to be as close as it possible to the web server.

To make sure I benchmark web servers instead of disk I/O I set all logs to go to memory (/dev/shm). PHP sessions were directed to memcached.
Both servers were using Zend Optimizer Plus with opcache.revalidate_freq set to 1 hour. I use Zend Optimizer because APC wasn’t stable for me with PHP 5.4.x.
If you aren’t familiar with PHP accelerators they convert PHP scripts into byte code and keep them in shared memory. That brings significant boost of performance (40-90%) because PHP scripts don’t have to be read from a disc and parsed on every request. Using the accelerator helped me removing I/O from the equation.

It’s very important to make sure Apache won’t read .htaccess. You can achieve it by setting Allow Overwrite to none. Parsing htaccess in real time will drop performance on the Apache side. It’s recommended to not use this file in production environment. Continue reading »

10月 152011
 

话说nginx在大压力的环境中比apache的表现要好,于是下载了一个来折腾一下。

下载并编译安装,我的编译过程有点特别:

1。去除调试信息,修改$nginx_setup_path/auto/cc/gcc这个文件,将 CFLAGS=”$CFLAGS -g”  这一行注释掉。

2。由于仅测试WEB服务器的性能,所以不安装FastCGI。 Continue reading »