1.Nginx
brew install nginx
#设置自启动
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
#Nginx命令
sudo nginx # start
sudo nginx -s stop # stop
sudo nginx -s reload # restart
#Nginx配置文件
/usr/local/etc/nginx
默认的Nginx端口是8080
2.PHP_FPM
#添加brew的PHP源
sudo brew tap homebrew/dupes
sudo brew tap homebrew/versions
sudo brew tap homebrew/homebrew-php
#安装PHP
sudo brew install -v --with-fpm --disable-opcache --with-imap php56
#设置自启动
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
#设置环境变量
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
#启动和关闭PHP_FPM
sudo /usr/local/opt/php56/sbin/php56-fpm start
sudo /usr/local/opt/php56/sbin/php56-fpm restart
sudo /usr/local/opt/php56/sbin/php56-fpm stop
sudo /usr/local/opt/php56/sbin/php56-fpm status
其实并不用上面那么复杂
Usage: /usr/local/sbin/php56-fpm {start|stop|force-quit|restart|reload|status}
直接运行
sudo php56-fpm start
sudo php56-fpm stop
sudo php56-fpm restart
3.Mariadb
brew install mariadb
#运行
mysql.server start
mysql.server stop
mysql.server restart
#设置密码
mysql_secure_installation
#查询版本
select @@version;
mysql启动失败解决方案
参考http://unix-like.dyndns-web.com/?p=242