当前位置: 代码迷 >> PHP >> Mac Lion 10.7.2 用MacPorts装配 Nginx + PHP-FPM
  详细解决方案

Mac Lion 10.7.2 用MacPorts装配 Nginx + PHP-FPM

热度:491   发布时间:2016-04-28 18:48:20.0
Mac Lion 10.7.2 用MacPorts安装 Nginx + PHP-FPM

Mac Lion 10.7.2 用MacPorts安装 Nginx + PHP-FPM

?

sudo port -v selfupdate

?

?

修改PHP5的Portfile文件

?

sudo vi /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/php5/Portfile

?

?

找到 configure.args?加入一行:–enable-fpm
找到 xinstall …….php-cgi 注释掉

?

?

sudo port install nginx php5 +fastcgi php5-apc php5-mysql +mysqlnd

?

?

修改nginx配置文件

?

sudo cp /opt/local/etc/nginx/nginx.conf.example /opt/local/etc/nginx/nginx.conf sudo vi /opt/local/etc/nginx/nginx.conf

?

?

修改php-fpm配置文件

?

sudo cp /opt/local/etc/php-fpm.conf.default /opt/local/etc/php-fpm.conf sudo vi /opt/local/etc/php-fpm.conf # 查找并编辑以下内容pid = run/php-fpm.pid error_log = log/php-fpm.log listen = /tmp/php-fpm.sock

?

?

修改php配置文件

sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.inisudo vi /opt/local/etc/php5/php.ini

?

?

安装相关的extension

?

sudo port install php5-extension

?

测试nginx配置文件

sudo nginx -t

?

其它相关命令

# 启动nginxsudo nginx# 重启sudo -s reload# 关闭sudo -s stop# 测试php-fpm配置文件sudo php-fpm -t# 启动sudo php-fpm# 立刻关闭 (INT, TERM)sudo kill -INT `cat /opt/local/var/run/php-fpm.pid`# 平滑终止 (QUIT)sudo kill -QUIT `cat /opt/local/var/run/php-fpm.pid`# 重启 (USR1, USR2)sudo kill -USR2 `cat /opt/local/var/run/php-fpm.pid`

??