homebrew php fpm,随手记:mac os maverick下安装nginx+php-fpm via homebrew

自己虽然平时爱折腾,却很少有记下来的习惯,除非碰到特别多问题的部署才会有冲动。今天看同事折腾git,在旁边看着他mac上的evernote满满的记了好几篇,全是技术相关的记录,忽然很感慨。过去解决了很多碎片化的问题,都没有系统地记下来,虽然今后也不能保证,但起码会决心挤出时间来写点东西(现在私人时间多了

13.gif

安装nginx:

mac上好用的软件包管理工具首选homebrew,他家的宣传口号牛逼得很,”mac ports driving you to drink?try home brew“ 记得当时google前还真被macport折磨得要吐

安装nginx很简单 ,brew install nginx 就可以了。其中有个小小提示:Warning: /usr/local/sbinis not in yourPATH只需要在/etc/paths中加入 /usr/local/sbin路径即可

mac自带了apache,默认的apache端口是80,nginx安装后默认是8080,我没有洁癖,没必要两个只能活一个,所以8080端口就留给nginx的测试

要使nginx开机启动,终端命令 launchctl load -w /System/Library/LaunchDaemon/org.apache***.plist *号是忘记了得内容,反正按tab就行 (同理unload可撤销)

配置文件/etc/nginx/nginx.conf 在其中的http内容中加入 include vhost/*.conf

新建vhost文件夹,这里按{域名}.conf的规则创建virtual host

安装php-fpm:

mac本身的php就支持fpm,php info查看fpm是否enable,否则可以用homebrew再装一次:

brew

tap

homebrew

/

dupes

brewtapjosegonzalez/homebrew-php

然后brew install php54 --with-fpm --with-mysql --with-tidy --with-debug

出现configure: error: Cannot find OpenSSL's ,homebrew github上有人回答了该问题

For future reference of anybody looking for Command Line Tools with Xcode 5, open up a Terminal window and type xcode-select --install. A window will appear informing you command line tools are required. Click Install and you should be good to go

xcode-select --install, 重新安装后通过

启动fpm:php-fpm 提示找不到conf和log,cp/private/etc/php-fpm.conf.default /private/etc/php-fpm.conf,根据提示的error log路径创建文件或在conf中修改error log路径,运行正常修改nginx中php fpm的注释,如果配置了vhost则配置文件加入相对的php location内容,script指向root path.

开机启动php-fpm

vi /System/Library/LaunchDaemon/org.php.php-fpm.plist:

Labelphp-fpm

Program/usr/sbin/php-fpm

KeepAlive

launchctl load -w /System/Library/LaunchDaemon/org.php.php-fpm.plist

Thats all.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值