In peacetime work has been exposed to Nginx and Apache two Web server, has not clarified the difference between the two, specifically to find some information and blog, finally is to understand the favorite noodles specially to share with you. Nginx compared to the advantages of Apache Lightweight, the same Web services, more than Apache occupy less memory and resources anti-concurrency, Nginx processing requests are asynchronous non-blocking, and Apache is blocking type, in high concurrency, nginx can keep low resource consumption high High performance modular design, writing modules relatively simple community active, a variety of high-performance modules produced quickly AH
Apache relative Nginx advantages rewrite, more than Nginx rewrite powerful modules, the basic thought can find fewer bugs, Nginx bug relatively more ultra-stable
Summarize
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.