nginx除了用proxy_pass來做負載平衡,還有別的方法嗎?
仅有的幸福
仅有的幸福 2017-05-16 17:07:31
0
1
601

之前面試的時候,有人問我的。 。 。

仅有的幸福
仅有的幸福

全部回覆(1)
漂亮男人

例如PHP負載平衡不需要反向代理,直接fastcgi_pass到多個php-fpm也可以做負載平衡。

具體配置:

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;
    }
}
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!