Web server Nginx and apache_php tutorial

Source: Internet
Author: User
Tags epoll hosting
The Web server that is recently ready to set up PHP, the following content for reference.

1, the advantages of nginx with respect to Apache:
lightweight, the same Web service, than Apache consumes less memory and resources
anti-concurrency, Nginx processing requests are asynchronous and non-blocking, while Apache is a blocking type , Nginx can keep low resource consumption and high performance in high concurrency
Highly modular design, relatively simple to write modules
Community active, a variety of high-performance modules produced quickly AH
The advantages of Apache with respect to Nginx:

Rewrite, stronger than Nginx's rewrite

Dynamic pages

The module is too much, the basic thought can be found
Fewer bugs, nginx bugs are relatively large

Ultra-Stable

existence is the reason, in general,Web services that require performance, using Nginx. If performance is not required for stability, then Apacheit. The latter of the various functional modules implemented than the former, such as the SSL module is better than the former, more configurable items. One thing to note here is that Epoll (FreeBSD is kqueue) network IO Model is the fundamental reason for the high performance of nginx processing, but not all cases are epoll victory, if you provide static services only a few files, Apache Select Models may be more performant than Epoll. Of course, this is just a hypothesis based on the principle of the network IO model, and the actual application still needs to be measured.

2, 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 responses of up to 50,000 concurrent connections,We thank 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.
as a mail proxy: Nginx is also a very good mail proxy server (one of the first to develop this product is also as a mail proxy server), Last.fm describes the success and wonderful use of experience.
Nginx is a very simple installation, the configuration file is very concise (also can support Perl syntax), Bugs very few servers: Nginx boot is particularly easy, and can be almost uninterrupted operation, even if the run for several months do not need to restart. You will also be able to upgrade the software version without interruption of service.

3, Nginx configuration concise, Apache complex
Nginx static processing performance 3 times times higher than Apache
Apache support for PHP is relatively simple, Nginx needs to cooperate with other backend
Apache has more components than Nginx
now Nginx is the preferred Web server

4, the most important difference is that Apache is a synchronous multi-process model, a connection corresponding to a process; Nginx is asynchronous, multiple connections (million levels) can correspond to a process

5,nginx processing static file is good, consumes less memory . But Apache is undoubtedly still the mainstream, with a lot of rich features. So it needs to be paired. Of course, if you can be sure that Nginx is suitable for your needs, then using Nginx will be a more economical approach.

Apache does not support multi-core to download the Chicken rib shortage, recommend using Nginx to do the front end, the back end with Apache. Large Web site suggestions for the use of nginx-generation cluster function

6, from the personal past use of the situation, nginx load capacity is much higher than Apache. The newest server also changed to Nginx. and Nginx change the configuration can be-t test configuration is not a problem, the Apache restart when the configuration error found, will be very crash, change will be very cautious now see a lot of cluster station, front-end nginx anti-concurrency, back-end Apache cluster, with good.


7, nginx processing dynamic request is chicken, general dynamic request to Apache to do, nginx only suitable for static and reverse.

8, from my experience, Nginx is a very good front-end service, load performance is excellent, in the old Ben on the Nginx, with the webbench simulation of 10,000 static file please do not have the difficulty. Apache's support for languages such as PHP is good, and Apache has a strong support network, which is more time-out than Nginx,

9, Nginx is superior to Apache's main two points: the 1.Nginx itself is a reverse proxy server 2.Nginx support 7 layer load balancing; Of course, nginx may support higher concurrency than Apache, but according to Netcraft statistics, April 2011 Statistics, Apache still occupies 62.71%, and Nginx is 7.35%, so always, Aapche is still the majority of companies first, because its mature technology and development community has also been very good performance.

10, your requirements for Web server determine your choice. In most cases, Nginx is superior to Apache, such as static file processing, php-cgi support, reverse proxy functionality, front-end cache, maintenance connections, and so on. In apache+php (prefork) mode, if the PHP process is slow or the front-end pressure is very high, it is easy to get a spike in the number of Apache processes, thereby denying service.

11, you can see the Nginx LUA module: Https://github.com/chaoslaw...apache more than Nginx module, Apache is the most popular to implement directly with Lua, why? Most people are lazy to update to nginx or learn new things

12, for Nginx, I like it configuration file is very concise, regular configuration makes a lot of things easy to run high efficiency, less resources, powerful proxy, very suitable for the front-end response server

13, Apache in processing dynamic has advantages, nginx concurrency is good, CPU memory consumption is low, if rewrite frequent, it is Apache bar

http://www.cnblogs.com/roucheng/

http://www.bkjia.com/PHPjc/626664.html www.bkjia.com true http://www.bkjia.com/PHPjc/626664.html techarticle The Web server that is recently ready to set up PHP, the following content for reference. 1, Nginx compared to the advantages of Apache: Lightweight, the same Web services, more than Apache occupy less memory and resources anti-and ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.