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.ini
sudo vi /opt/local/etc/php5/php.ini

 

 

安装相关的extension

 

sudo port install php5-extension

 

测试nginx配置文件

sudo nginx -t

 

其它相关命令

# 启动nginx
sudo 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`

  

你可能感兴趣的:(PHP,nginx,osx,mac,port)