vi /etc/php-fpm.d/www.conf listen = 192.168.37.142:9000 listen.allowed_clients = 192.168.37.142,172.17.10.213 vi /etc/nginx/conf.d/default.conf upstream php_server { #定义定义php服务器池,权重都为1,相当于访问模式是轮询 server 192.168.1.132:9000 weight=1; server 192.168.1.130:9000 weight=1; } server { listen 80; server_name localhost; location ~ \.php$ { root /var/www/html/webphp; #两台php服务器中都必须要有这个目录,里面可以有不同的文件 fastcgi_pass php_server; #这里要修改为php服务器池,而不是单个服务器 fastcgi_index index.php; include fastcgi.conf; } }