The advantages of Nginx relative to Apache:
- Lightweight, same Web service, consumes less memory and resources than Apache
- Anti-concurrency, Nginx processing requests are asynchronous non-blocking, and Apache is blocking type, in high concurrency, nginx can keep low resource consumption and high performance
- Highly modular design, relatively simple to write modules
- Community active, a variety of high-performance modules produced quickly AH
The advantages of Apache relative Nginx:
- Rewrite, stronger than Nginx's rewrite
- The module is too much, the basic thought can be found
- Fewer bugs, nginx bugs are relatively large
- Ultra-Stable
Advantages and Disadvantages
1, as a WEB server: using less resources than Apache,nginx, supporting more concurrent connections, reflecting higher efficiency, which makes Nginx particularly popular with virtual hosting providers. In the case of high connection concurrency, Nginx is a good alternative to Apache server: Nginx in the United States is a virtual hosting business owners often choose one of the software platform. Capable of supporting up to 50,000 concurrent connections, thanks to Nginx for choosing Epoll and Kqueue as the development model.
Nginx as a Load Balancer server: Nginx can either directly support the internal Rails and PHP programs outside the service, also can support as an HTTP proxy server external services. Nginx is written in C, which is much better than Perlbal, both in terms of system resource overhead and CPU efficiency.
2, Nginx configuration is concise, Apache complex, Nginx Start is particularly easy, and almost can do uninterrupted operation, even if the operation for several months do not need to restart. You will also be able to upgrade the software version without interruption of service. Nginx Static processing performance is 3 times times higher than Apache, Apache support for PHP is relatively simple, nginx need to cooperate with other backend to use, Apache more than Nginx components.
3, the most important difference is that Apache is a synchronous multi-process model, a connection corresponding to a process; Nginx is asynchronous, and multiple connections (million levels) can correspond to a process.
4, Nginx's advantage is to handle static requests, CPU memory usage is low, Apache suitable for processing dynamic requests, so now the general front-end with Nginx as the reverse proxy anti-pressure, Apache as the back-end processing of dynamic requests.
The pros and cons of Nginx and Apache