In addition to using proxy_pass for load balancing, is there any other way for nginx?
仅有的幸福
仅有的幸福 2017-05-16 17:07:31
0
1
632

Someone asked me this during the previous interview. . .

仅有的幸福
仅有的幸福

reply all(1)
漂亮男人

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;
    }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template