Home >Backend Development >PHP Tutorial >A question about Nginx reverse proxy

A question about Nginx reverse proxy

WBOY
WBOYOriginal
2016-07-06 13:51:301141browse

I am starting to tinker with nginx for the first time, please understand the newbie issues, thank you!

Nginx can reverse proxy Apache to process the dynamic part into a LANMP combination.
I have a few questions from this:

1. Is Apache in LANMP scenario apache mod_php? Or apache php-fpm or fcgi, etc. can be used?

2. Does nginx php-fpm under LNMP also process .php? Is combining LANMP and Apache just to solve the stability problem under LNMP?

3. If the LANMP architecture uses apache php-fpm, is it better to use LNMP directly? Are the instability factors mainly in php-fpm?

4. It is said that the performance of mod_php is not as good as php-fpm. If LANMP is built to pursue the stability or scalability of apache mod_php, then will LANMP be inferior to LNMP in terms of performance?

Reply content:

I’m starting to tinker with nginx for the first time, please understand the novice questions, thank you!

Nginx can reverse proxy Apache to process the dynamic part into a LANMP combination.
I have a few questions from this:

1. Is Apache in LANMP scenario apache mod_php? Or apache php-fpm or fcgi, etc. can be used?

2. Does nginx php-fpm under LNMP also process .php? Is combining LANMP and Apache just to solve the stability problem under LNMP?

3. If the LANMP architecture uses apache php-fpm, is it better to use LNMP directly? Are the instability factors mainly in php-fpm?

4. It is said that the performance of mod_php is not as good as php-fpm. If LANMP is built to pursue the stability or scalability of apache mod_php, then will LANMP be inferior to LNMP in terms of performance?

1. Generally speaking, apache mod_php;
2. In terms of performance, nginx handles static files better than apache, and the mod loading method of apache mod_php has better performance than nginx php-fpm. Combining LANMP is for optimal performance;
3. apache php-fpm, I have not seen anyone using it so far. Because Apache's internal processing mechanism is very strong, it is usually made into a mod. On the contrary, nginx does almost nothing by itself, and everything is handled externally.
4. I have never heard that the performance of mod_php is not as good as php-fpm. To be precise, this is related to the traffic model.

And in terms of performance, ordinary low-end servers cannot show any obvious difference between the two. Of course, if you use the default configuration file, then nginx with more static requests will definitely win. Just the memory consumed by apache after starting will give you the illusion of being a big boss. However, in fact, just for the warm-up exercise of dynamic processing, it has already surpassed nginx, a small engine that can only do static and forwarding.

1.php generally does not limit whether it is mod_php, php-fpm or fcgi, it depends on your php version. Nowadays, php-fpm is generally used. This only refers to php
2.nginx only does reverse proxy, right? Of course, nginx can also be used as a server, but it should not be used as a server here.
3. The instability factor may not necessarily be in php-fpm, but may also be in the concurrent processing middleware. For details, you can search and compare the performance advantages of apache and nginx.
4. Generally speaking, there may be some differences in ease of use and stability as the system grows. Simple architecture may not have much impact.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn