nginx+php简单配置环境

首先我的需求是:

1. 需要有PHP的服务。web目录存放在各处。

2. 需要有多个端口。

步骤:

1. 安装nginx php,我的系统是mac 所以安装使用brew, 一键完成。。。 

2. 开启php-fastcgi. 

nohup php-cgi -b 3344&

  简单要说明,nohup 表示后端启动 ,商品为3344

3. 配置nginx

location ~ .php$ {
            root           /Users/yansunrong/demo;
            fastcgi_pass   127.0.0.1:3344;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

重启nginx 

sudo nginx -s reload
原文地址:https://www.cnblogs.com/well1010/p/3494634.html