nginx能够通过upstream的方式,把请求分配到不同的phpcgi服务上。

#phpcgi/etc/php-fpm.conf
listen = 10.241.133.144:9000   # 本地ip,非127.0.0.1
listen.allowed_clients = 10.241.133.137 # nginx server ip,非127.0.0.1

#nginx/conf/nginx.conf
upstream multiphp{
  server 10.241.133.144:9000 weight=1;
  server 127.0.0.1:9000 weight=1;
}
server{
  ……
  location ~ .*\.php{
    fastcgi_pass  multiphp;
    #fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include fastcgi.conf;
  }
}

Leave a Reply