nginx and apache

one,

The advantages of nginx over apache:

Lightweight, same as web  service , takes up less memory and resources than apache

Anti -  concurrency, nginx processes requests asynchronously and non-blocking, while apache is blocking. Under high concurrency, nginx can maintain low resource consumption and high performance

·  Highly modular design, relatively simple to write modules

·The  community is active, and various high-performance modules are produced quickly

The advantages of apache over nginx:

· rewrite , more powerful than nginx 's rewrite

There are so many modules ,  you can find everything you can think of

Less bugs nginx has relatively more bugs

·  Super stable

Existence is the reason, in general, web services that require performance, use nginx. If you don't need performance and only want stability, then apache. Various functional modules of the latter are implemented better than the former. For example, the modules of ssl are better than the former, and there are more configurable items.
It should be noted here that the network IO model of epoll (kqueue on freebsd) is the fundamental reason for the high processing performance of nginx, but epoll is not a complete victory in all cases. If it provides static services, only a few file, apache's select model may be more performant than epoll. Of course, this is just an assumption based on the principle of the network IO model, and the real application still needs to be measured.

two,

1. The advantages of nginx over apache
: it is lightweight, also serves as a web service, occupies less memory and resources than apache, and is resistant to concurrency. nginx processes requests asynchronously and non-blocking, while apache is blocking. Under nginx, it can maintain a low-resource, low-consumption, high-performance, highly modular design. The writing module is relatively simple. The community is active, and various high-performance modules are produced quickly
. The advantages of apache over nginx:
rewrite, more powerful than nginx's rewrite, dynamic pages, modules There are too many, you can find almost everything you can think of, few bugs, nginx has relatively many bugs, and the
existence is the reason. Generally speaking, nginx is used for web services that require performance. If you don't need performance and only want stability, then apache. Various functional modules of the latter are implemented better than the former. For example, the modules of ssl are better than the former, and there are more configurable items. It should be noted here that the network IO model of epoll (kqueue on freebsd) is the fundamental reason for the high processing performance of nginx, but not in all cases, epoll wins a big victory. If it provides static services, only a few file, apache's select model may be more performant than epoll.
2. As a web server : compared toApache and Nginx use less resources, support more concurrent connections, and reflect higher efficiency, which makes Nginx especially popular with web hosting providers. In the case of high connection concurrency, Nginx is a good alternative to the Apache server: Nginx is one of the software platforms often chosen by owners of web hosting businesses in the United States. It can support up to 50,000 concurrent connections. The number of responses, thanks to Nginx for We chose epoll and kqueue as the development model.
Nginx as a load balancing server: Nginx can directly support Rails and PHP programs to serve externally, and can also support external services as an HTTP proxy server. Nginx is written in C, whether it is System resource overhead and CPU usage efficiency are much better than Perlbal.
As a mail proxy server : Nginx is also a very good mail proxy server (one of the earliest purposes of developing this product is also as a mail proxy server), Last.fm describes the success And a wonderful experience.
Nginx is a very easy to install, very concise configuration file (also supports perl syntax), very few bugs server: Nginx is very easy to start, and can run almost 24/7, even if It does not need to be restarted after running for several months. You can also upgrade the software version under the condition of uninterrupted service.
3. Nginx configuration is simple , Apache complex
Nginx static processing performance is more than 3 times higher than
Apache, Apache supports PHP is relatively simple, Nginx needs to cooperate with other backend
components using Apache more than Nginx
nowNginx is the first choice for web servers
4. The core difference is that apache is a synchronous multi-process model, one connection corresponds to one process; nginx is asynchronous, and multiple connections (10,000 levels) can correspond to one process 5.
nginx handles static fileswell
, consumes less memory. But there is no doubt that apache is still the mainstream at present, with many rich features. So it needs to be matched. Of course, if you can determine that nginx is suitable for your needs, then using nginx will be a more economical way. To support the disadvantage of multi-core processing load, it is recommended to use nginx as the front end and apache as the back end. It is recommended to use nginx's self-generation cluster function for large websites.
6. The load capacity of nginx is much higher than that of apache. The latest server has also switched to nginx. And after nginx has changed the configuration, you can -t test to see if there is any problem with the configuration. When apache restarts, it will be found that the configuration is wrong, and it will crash very carefully. , it fits well.
7. It is tasteless for nginx to handle dynamic requests . Generally, apache does dynamic requests. nginx is only suitable for static and reverse.
8. nginx is a very good front-end server with good load performance and runs on the old bennginx, it is easy to simulate 10,000 static file requests with webbench. Apache supports php and other languages ​​very well. In addition, apache has a strong support network and has a longer development time than nginx.
9. The main two points of Nginx are better than apache : 1. Nginx itself is a reverse proxy server 2. Nginx Supports 7-layer load balancing; Of course, Nginx may support higher concurrency than apache, but according to NetCraft's statistics, in April 2011, Apache still accounted for 62.71%, while Nginx was 7.35%, so it always comes It is said that Aapche is still the first for most companies, because its mature technology and development community have also been very good performance.
10. Your web server needs determine your choice . In most cases, nginx is better than APACHE, such as static file processing, PHP-CGI support, reverse proxy function, front-end Cache, maintaining connections, etc. In the Apache+PHP (prefork) mode, if the PHP processing is slow or the front-end pressure is high, the number of Apache processes is likely to soar, resulting in denial of service.
11. You can take a look at the nginx lua module : https://github.com/chaoslaw...apache is moreThere are many modules in nginx, and apache can be directly implemented with lua. Why? Most people do not bother to update to nginx or learn
new things Response server 13. Apache has advantages in processing dynamics. Nginx has better concurrency and low CPU and memory usage. If rewrite is frequent, then Apache is the best choice.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325482648&siteId=291194637