Introduction to 2 deployment methods
The first one
The second type
As shown below:
Comparison
From a system design perspective
The first deployment method is the conventional deployment method, which can be applied to large, medium and small-scale websites.
The second method is to deploy different services on different servers, which is more detailed. But there are also several problems:
From a performance perspective
Compared with the second deployment method, the first method requires one more inter-process interaction.
In the first deployment, the interaction through the network is the HTTP protocol, and in the second type, the interaction through the network It is the fast-cgi protocol. How do these two protocols compare?
From an operation and maintenance perspective
The first is the most common deployment method, which is simple and unified. The services on all servers that provide web services are isomorphic, monotonous and extensive.
The second method is to deploy nginx and php-fpm separately, and the distribution of different services on the server cluster is more detailed. If you count the pressure distribution in Web services, you can make more precise use of hardware resources. Operation and maintenance costs are also higher.
From a development and testing perspective
Both deployment methods are not suitable for development or testing environments.
In the development and testing environment, nginx and PHP can be deployed on one server. Reverse proxy and load balancing are not required.
Summary
If it is a LAMP environment deployment, the first type is more common.
If it is not LAMP, it is nginx interacting with other fastcgi services, such as C/C++ and java fastcgi programs. In large-scale network applications, deployment similar to the second one is common. Separate deployment of different services simplifies the network structure of the system and makes maintenance easier.
Postscript
The content of this blog post comes from discussions with former Baidu colleagues in the QQ group.
Please indicate the source when reprinting
Blog homepage: Zuocheng’s technical blog
Article title: "Nginx Comparison with two deployment methods of PHP》
Link to this article: http://it.zuocheng.net/compare-2-nginx-php-deployee-mode-zh
The above has introduced the comparison of the two deployment methods of Nginx and PHP, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.