nginx and Apache comparative advantages and disadvantages

Apache and the advantages and disadvantages Nginx 
1, nginx advantages with respect to the apache: 
lightweight, from the same web service, take up less memory than the apache resources and 
anti-concurrent, non-blocking Nginx processing request is asynchronous, and is apache obstructive, and in nginx under high concurrency to maintain low resources consumption of high-performance 
, highly modular design, the preparation module is relatively simple 
community activists, all kinds of high-performance modules produced rapidly ah 
apache nginx's relative advantages: 
rewrite, than the nginx rewrite a powerful 
module over more basic thought can be found 
less bug, nginx relatively large number of bug 
ultra-stable 
existence is the reason, in general, require the performance of web services, using nginx. If you do not just stable performance, then apache it. The latter have various functional modules implemented than the former, it is a good example ssl former module, multiple items can be configured. Here we must note that, epoll (on freebsd is kqueue) network IO model is a high-performance processing nginx fundamental reason, but not all cases are epoll victory, if itself provides static service on only a few files, apache of select high-performance model may be more than epoll. Of course, this is only based on the principle of network IO model for a hypothetical real applications still need a repeat measurement of. 

2, as a Web server: compared to Apache, Nginx use fewer resources to support more concurrent connections, reflecting higher efficiency, especially by this point the Nginx web hosting provider welcome. In the case of high concurrent connections, Nginx is a good alternative to the Apache server: Nginx in the United States is one to do web hosting business owners often choose software platform capable of supporting up to 50,000 concurrent response to the number of connections, thanks to Nginx. we chose epoll and kqueue as a development model. 
Nginx as a load balancing server:. Nginx either directly support within the Rails and PHP programs in foreign service, it can also support as an HTTP proxy server in foreign service Nginx using C to write, whether it is system resource overhead or CPU efficiency than Perlbal much better. 
as a mail proxy server: Nginx is also a very good mail proxy server (one of the earliest development of the purpose of this product is as a mail proxy server), Last.fm describe success and a wonderful experience 
Nginx is a very simple installation, configuration files is very simple (also supports perl syntax), Bugs very little server: Nginx starts are particularly vulnerable, and can be done almost 7 * 24 uninterrupted operation, even if do not need to run for several months Restart. Upgrading the software version of the case you can also uninterrupted service. 

3, Nginx configuration is simple, Apache complex 
Nginx static processing performance more than three times higher than Apache 
Apache is relatively simple support for PHP, Nginx need to cooperate with other back-end 
and more than Nginx Apache components 
now Nginx Web server is the first choice 

4, the core difference is that apache is synchronized multi-process model, a connection corresponds to a process; nginx is asynchronous, multiple connections (million level) may correspond to a process 

. 5, nginx handle static files consume less memory but no doubt apache is still the mainstream, there are a lot of feature rich, so it needs to match the course if you are sure nginx to fit needs, then use nginx would be a more economical manner. 

6, from a personal point of view the use of the past, nginx load capacity is much higher than apache. The latest server also use the nginx. After you configure and change the nginx -t test can be configured with no problem, restart apache, I noticed something goes wrong, it will collapse, change is going to be very careful now to see there are a lot cluster stations, anti-concurrent nginx front-end, back-end cluster apache , with the bad. 

7, nginx handle dynamic requests is tasteless, general dynamic requests to do apache, nginx is only suitable for static and reverse. 

8, from my personal experience, nginx front-end server is very good, very good load performance, nginx open in the old Ben, with Analog 10000 webbench static file requests without difficulty. apache good support for php and other languages, in addition to a strong support network apache, nginx development time is relatively longer, bug apache but there is little innate does not support multi-core processing load tasteless shortcomings, it is recommended to do nginx front-end, back-end with apache. Recommended that large sites with nginx self-generation clustering capabilities 

9, Nginx better than apache's main points: 1.Nginx itself is a reverse proxy server 2.Nginx support layer 7 load balancing; the other, of course, Nginx may be higher than support for apache higher concurrency, but according to NetCraft statistics, statistics of April 2011, Apache still holds 62.71%, while Nginx is 7.35%, so generally speaking, Aapche still most companies first, because of its mature technology and development community has also a very good performance. 

10, the demand for web server you determine your choice. Nginx in most cases are better than APACHE, such as static file handling, PHP-CGI support, reverse proxy function, front-end Cache, to maintain the connection and so on. In Apache + PHP (prefork) mode, if a large front-end PHP or slow processing of cases under pressure, it is prone to Apache soaring number of processes, thereby denying the phenomenon services. 

11, can look at nginx lua module: https: //github.com/chaoslaw...apache more than nginx module, can be directly used lua achieve apache is the most popular, why? Most people do not bother to update or learn new things nginx 

12, for nginx, I like it very simple to write the configuration file, the regular configuration for a lot of things become simple high operating efficiency, small footprint, powerful agent, it is suitable for front-end response from the server 

13, Apache has an advantage in dealing with dynamic, Nginx better concurrency, low CPU memory footprint, if rewrite frequently, and that was it Apache

## part borrowed from other chiefs, the temporary do with personal collection

Guess you like

Origin www.cnblogs.com/garyzhuang/p/11510781.html