- 安装homebrew
- 安装nginx
- 安装php
- 安装mysql
- nginx/php/mysql的启动、关闭、重启命令
- 问题解决
1. homebrew的安装
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
2. 安装nginx
brew install nginx
配置文件目录:
/usr/local/etc/nginx
3. 安装php
brew tap homebrew/dupes
brew tap homebrew/php
brew install --without-apache --with-fpm --with-mysql php55
配置文件目录:/usr/local/etc/php
4. 安装mysql
brew install cmake
brew install mysql
配置文件目录:/usr/local/Cellar/mysql/5.6.21/my.cnf
5. nginx/php/mysql的启动、关闭、重启命令
在.bashrc文件中添加如下行:# nginx
alias nginx-start="sudo /usr/local/bin/nginx"
alias nginx-stop="sudo /usr/local/bin/nginx -s stop"
alias nginx-reload="sudo /usr/local/bin/nginx -s reload"
alias nginx-t="sudo /usr/local/bin/nginx -t"
alias nginx-restart="nginx-stop ; nginx-start"
# php
alias php-start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist"
alias php-stop="killall php-fpm"
alias php-restart="php-stop && php-start"
# mysql
alias mysql-start="/usr/local/bin/mysql.server start"
alias mysql-stop="/usr/local/bin/mysql.server stop"
alias mysql-restart="/usr/local/bin/mysql.server restart"
6. 问题解决
6.1 错误一: 端口问题
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)解决: 启动添加sudo,只有root用户才能使用1024以下端口的问题
6.2 错误二: 文件描述符限制
nginx: [warn] 10240 worker_connections exceed open file resource limit: 256解决:
sudo launchctl limit maxfiles 16384 16384
ulimit -n 16384
没有评论:
发表评论