Someone asked me this during the previous interview. . .
漂亮男人2017-05-16 17:09:31
For example, PHP load balancing does not require a reverse proxy. Direct fastcgi_pass to multiple php-fpm can also be used for load balancing.
Specific configuration:
upstream myapp {
server 192.168.20.1:9000; # PHP-FPM 1
server 192.168.20.2:9000; # PHP-FPM 2
......
}
server {
listen 80;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /phpfiles$fastcgi_script_name;
fastcgi_pass myapp;
}
}