// If you use Bash 打开如下路径下的文件 ~/.bash_profile // If you use ZSH 打开如下路径下的文件 ~/.zshrc
在 aliases 的位置 添加如下配置:
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist' alias nginx.restart='nginx.stop && nginx.start' alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist" alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist" alias php-fpm.restart='php-fpm.stop && php-fpm.start' alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist" alias mysql.restart='mysql.stop && mysql.start' alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log' alias nginx.logs.access='tail -250f /usr/local/etc/nginx/logs/access.log' alias nginx.logs.default.access='tail -250f /usr/local/etc/nginx/logs/default.access.log' alias nginx.logs.default-ssl.access='tail -250f /usr/local/etc/nginx/logs/default-ssl.access.log' alias nginx.logs.phpmyadmin.error='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.error.log' alias nginx.logs.phpmyadmin.access='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.access.log'
现在我们可以输入以下命令更新我们的变量 让我们的设置生效
1 2 3
source ~/.bash_profile //or source ~/.zshrc`
现在你可以使用更加简短的命名来优雅的开关服务 而不必打一长串的指令 路径 那很傻
1 2 3
nginx.start nginx.stop nginx.restart
总结
至此 PHP + Mysql + nginx 环境搭建完成。在进行下篇文章(Phabricator安装)之前需要启动相应的服务: