Mac 下 Nginx、PHP、MySQL 和 PHP-fpm 的安装和配置

安装 Mac 的包管理器 - homebrew

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

安装nginx服务器

brew install nginx

# 启动 nginx服务
sudo nginx

# 重新加载配置|重启|停止|退出 nginx
nginx -s reload|reopen|stop|quit

#测试配置是否有语法错误
nginx -t

开机启动nginx:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
安装配置MYSQL服务器

brew install mysql

设置密码:

/usr/local/bin/mysqladmin -u root password 'new-password'

开机启动:

mkdir -p ~/Library/LaunchAgents/cp /usr/local/Cellar/mysql/5.7.12/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

安装PHP 和 php-fpm:

brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php56 --with-imap --with-tidy --with-debug --with-pgsql --with-mysql --with-fpm
export PATH="$(brew --prefix php54)/bin:$PATH"

设置php-fpm开机启动:

mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist

mac下安装PHP扩展:

brew install php56-apcu php56-intl php56-redis php56-uuid php56-zookeeper 
    php56-thrift php56-solr php56-ssh2 php56-gmagick php56-kafka php56-libevent 
    php56-imagick php56-msgpack php56-geoip php56-mcrypt php56-swoole 
    php56-scrypt php56-xdebug php56-yaf php56-yaml php56-xhprof 
    php56-memcache php56-memcached php56-gearman
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值