Press "Enter" to skip to content

mac os 10.12 nginx+php7+mysql 安装笔记

mac  os 每次升级,新软件的配置文件地方会不一样,

这里依我实践安装的过程记下,当前mac os 版本 10.12 , nginx+php7+mysql 安装笔记:

新版mac自带apache+php5.6 , 需要自己安装nginx+php7,推荐brew安装,方便快捷。

1、brew

bew 安装说明:http://brew.sh/index_zh-cn.html

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

设置github token, 因为brew 会用到github源,提前准备好。

https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew

export HOMEBREW_GITHUB_API_TOKEN="your_github_token"

brew update

2、PHP7+php7-fpm

因为php7.1在项目中有bug,这里安装php7.0

brew install   --with-fpm --with-mysql homebrew/php/php70

brew search php70

可以搜索很多插件,可以根据要求安装,比如:

homebrew/php/php70-imagick

homebrew/php/php70-mcrypt

homebrew/php/php70-msgpack

php7的配置文件位置:/usr/local/etc/php/7.0

phpize需要autoconf,

 brew install autoconf

3、nginx

    brew install nginx

设置开机启动nignx

sudo cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/
sudo chmod 777  /Library/LaunchDaemons/homebrew.mxcl.nginx.plist

nginx 配置文件:/usr/local/etc/nginx/

4、mysql5.7

安装mysql
brew install mysql
设置账户密码
mysql_secure_installation
配置文件
cp /usr/local/opt/mysql/support-files/my-default.cnf /etc/my.cnf

    

Comments are closed.