Home >Backend Development >PHP Tutorial >nginx php-fpm如何分开部署

nginx php-fpm如何分开部署

WBOY
WBOYOriginal
2016-06-06 20:43:261806browse

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

回复内容:

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

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

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

<code>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; 
    } 
</code>

修改fastcgi配置参数即可

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

借地方问一下,

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn