Home  >  Q&A  >  body text

nginx php-fpm如何分开部署

有两台服务器A B, A安装nginx, B安装php,这时候nginx和php如何配置?

天蓬老师天蓬老师2748 days ago621

reply all(5)I'll reply

  • PHP中文网

    PHP中文网2017-04-10 14:59:22

    配置基本不会变。调好防火墙,只把nginx暴露给外网。把平时nginx发给fpm时使用的地址从127.0.0.1改成B服务器的地址,在php-fpm里设置listen于B的局域网地址,listen.allowed_clients加上A的局域网地址就好。

    注意此时nginx服务器和php服务器的网站目录结构需要保持一致。

    reply
    0
  • PHP中文网

    PHP中文网2017-04-10 14:59:22

    root  /usr/local/web/www/;
        location ~ .*\.(php|php5)?$
        { 
          #fastcgi_pass  unix:/tmp/php-cgi.sock; 
          fastcgi_pass  127.0.0.1:9000;  ##你懂得
          fastcgi_index index.php; 
          include fcgi.conf; 
        } 
    

    reply
    0
  • 阿神

    阿神2017-04-10 14:59:22

    修改fastcgi配置参数即可

    reply
    0
  • ringa_lee

    ringa_lee2017-04-10 14:59:22

    性能很差 没有nginx+(nginx+php-fpm)的快

    reply
    0
  • 高洛峰

    高洛峰2017-04-10 14:59:22

    借地方问一下,

    nginx和php两台机器上都要部署web吗?代码两台机器都要?

    reply
    0
  • Cancelreply