Asweallknow: currently, web server software is divided into two main camps: Apache, known for its maturity and stability, and nginx is deployed with fewer memory usage and anti-concurrency. So, as a PHP developer, what should I pay attention to in lamp and lnmp environments... as we all know, currently the web server software is divided into two main camps, one is Apache, known for its maturity and stability, and the new nginx is deployed with fewer memory usage and anti-concurrency. So, as a PHP developer, what should I pay attention to in lamp and lnmp environments? For example, if apache is a blocking type and nginx is an asynchronous non-blocking type, will this affect the execution sequence of the program? What other aspects will be different? We would like to thank each respondent.
Reply content:
As we all know, currently the web server software is divided into two main camps, one is Apache, known for its maturity and stability, and the new nginx is deployed with fewer memory usage and anti-concurrency. So, as a PHP developer, what should I pay attention to in lamp and lnmp environments? For example, if apache is a blocking type and nginx is an asynchronous non-blocking type, will this affect the execution sequence of the program? What other aspects will be different? We would like to thank each respondent.
In fact, you don't have to worry too much about this problem, because small websites do not matter whether apache or nginx is used.
Websites with high traffic volumes use not only apache or nginx, but also lnmpa architecture.
Nginx is highly capable of handling static files and high concurrency, while apache is more capable of handling dynamic programs. Therefore, large websites generally use nginx as a reverse proxy. static files are directly returned and dynamic requests are forwarded to apache.
Now, both Apache and Nginx forward requests to php-fpm. There is no difference in code development.
If your application is not asynchronous and non-blocking, those will not be affected.
Both apache and nginx can use php-fpm.
LNPP passed ......
NGINX is responsible for processing static resources. APACHE processes dynamic scripts, also known as lnmpa.
I recently stepped on this pitfall. At present, the small site PV20W +, a single machine with 4 cores and 4 GB memory, uses the lanmp (php5.5 + mysql5.6 + apache 2.4 + nginx 1.6) environment. Note that it is a single machine, the CPU usage is usually 100% during peak periods. The previously used lnmp (php5.1 + nginx 1.4 + mysql 5.1) is the same concurrency. during peak periods, the CPU usage does not exceed 70%, and the load has been very stable, I am currently trying to replace it with the Linux eye package for lnmp (nginx 1.6 + php 5.6!