mac brew 安装 nginx fpm mysql 教程
一. 安装brew
要求:OS X 10.6以上系统,并且安装有XCode命令行工具
对于10.11的系统需要设置下local的权限为当前用户
$ sudo chown -R $(whoami):admin /usr/local
brew安装程序的过程中需要用到苹果的xcode中的 编译器,你可以到苹果的官网中免费下载安装(需要注册免费的开发者,然后才能下载),安装后到属性(Xcode – Perference–Downloads–Components–Command Line Tools)点击下载就可以了,这里使用命令安装
xcode-select --install
进入到 /usr/local 然后执行代码安装brew
$ cd /usr/local
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
上面的安装只是将Homebrew解压到本地,还需要配置环境变量才能使用brew命令
$ touch ~/.bash_profile
$ open ~/.bash_profile
$ export PATH=/usr/local/bin:$PATH
$ source ~/.bash_profile
检查下brew的安装情况 我的是没问题的 然后执行update 更新软件
$ brew doctor
$ brew update
brew常用命令
brew –help 查看brew的帮助
brew install git 安装软件
brew uninstall git 卸载软件
brew search git 搜索软件
brew list 显示已经安装软件列表
brew update 更新软件,把所有的Formula目录更新,并且会对本机已经安装并有更新的软件用*标明。
brew upgrade git 更新某具体软件
brew [info | home] [FORMULA...] 查看软件信息
删除程序,和upgrade一样,单个软件删除和所有程序老版删除。
brew cleanup git
brew cleanup
brew outdated 查看那些已安装的程序需要更新 brew home *—用浏览器打开
brew deps * — 显示包依赖
brew server * —启动web服务器,可以通过浏览器访问http://localhost:4567/ 来同网页来管理包
brew -h brew —帮助
安装Nginx
$ brew search nginx
$ brew install nginx
安装成功后的一些配置信息
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To have launchd start nginx at login:
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
Then to load nginx now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Or, if you don't want/need launchctl, you can just run:
nginx
根据提示设置开机启动
$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
现在就启动nginx的方式有两种
Then to load nginx now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Or, if you don't want/need launchctl, you can just run:
nginx
安装php
查找PHP
brew search php71
查看可以使用的选项
$ brew options homebrew/php/php71
--with-cgi
Enable building of the CGI executable (implies --without-fpm)
--with-debug
Compile with debugging symbols
--with-enchant
Build with enchant support
--with-gmp
Build with gmp support
--with-homebrew-apxs
Build against apxs in Homebrew prefix
--with-homebrew-curl
Include Curl support via Homebrew
--with-homebrew-libressl
Include LibreSSL instead of OpenSSL via Homebrew
--with-homebrew-libxml2
Include Libxml2 support via Homebrew
--with-homebrew-libxslt
Include LibXSLT support via Homebrew
--with-imap
Include IMAP extension
--with-libmysql
Include (old-style) libmysql support instead of mysqlnd
--with-mssql
Include MSSQL-DB support
--with-pdo-oci
Include Oracle databases (requries ORACLE_HOME be set)
--with-pear
Build with PEAR
--with-phpdbg
Enable building of the phpdbg SAPI executable (PHP 5.4 and above)
--with-postgresql
Build with postgresql support
--with-thread-safety
Build with thread safety
--without-apache
Disable building of shared Apache 2.0 Handler module
--without-bz2
Build without bz2 support
--without-fpm
Disable building of the fpm SAPI executable
--without-ldap
Build without LDAP support
--without-legacy-mysql
Do not include the deprecated mysql_ functions
--without-mysql
Remove MySQL/MariaDB support
--without-pcntl
Build without Process Control support
--HEAD
Install HEAD version
安装
brew install php71
/usr/local/etc/php/7.1/php-fpm
/usr/local/etc/php/7.1/php-fpm.conf
/usr/local/etc/php/7.1/php.ini
添加环境变量
PATH="/usr/local/sbin:$PATH"
/usr/local/sbin php和php-fpm目录
/usr/local/opt/php71/sbin 真实的php和fpm目录
/usr/local/etc/php/7.1/php-fpm 配置文件目录
/usr/local/etc/php/7.1/php-fpm.conf
/usr/local/etc/php/7.1/php.ini
nginx 添加对php的支持
location / {
root html;
//index index.html index.htm; //改为
index index.php index.html index.htm;
}
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
去掉注释
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改成
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
php扩展
使用brew search php71-命令,可以查看还有哪些扩展可以安装,然后执行brew install php71-XXX就可以了。
安装memcache
brew install homebrew/php/php71-memcache
安装mysql
brew install mysql
另外一篇参考文章
https://www.zybuluo.com/phper/note/313803
mac brew 安装 nginx fpm mysql 教程的更多相关文章
- Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境
准备工作 新版的 Mac OS 内置了Apache 和 PHP,我的系统版本是OS X 10.9.3,可以通过以下命令查看Apache和PHP的版本号: httpd -v Server version ...
- mac下安装nginx+php+mysql+xdebug
一,安装homebrew 就像linux下面有yum一样,mac也有个homebrew,管理软件非常便捷. 官网:http://brew.sh/index_zh-cn.html 上面有句命令,复制下来 ...
- Linux 安装Nginx+PHP+MySQL教程
一.安装nginx 通过yum安装openssl: yum -y install openssl openssl-devel 通过yum安装pcre: yum -y install pcre-deve ...
- Mac下用brew安装nginx
1. nginx nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TC ...
- Mac上使用brew安装Nginx服务器
使用brew安装nginx $ brew install nginx 启动nginx sudo nginx 访问localhost:8080 发现已出现nginx的欢迎页面了.  为方便期间,做个软 ...
- windows7配置Nginx+php+mysql教程
windows7配置Nginx+php+mysql教程 最近在学习php,想把自己的学习经历记录下来,并写一些经验,仅供参考交流.此文适合那些刚刚接触php,想要学习并想要自己搭建Nginx+php+ ...
- [mysql]brew 安装 配置 操作 mysql(中文问题)
mac 下卸载mysqldmg mac下mysql的DMG格式安装内有安装文件,却没有卸载文件--很郁闷的事. 网上搜了一下,发现给的方法原来得手动去删. 很多文章记述要删的文件不完整,后来在stac ...
- mac下安装nginx及相关配置
1. 安装 Homebrew 首先 homebrew是什么?它是Mac中的一款软件包管理工具,通过brew可以很方便的在Mac中安装软件或者是卸载软件.不了解的同学看以看官网(https://br ...
- Mac 下 安装 Nginx
---恢复内容开始--- Mac 下 安装nginx 首先确定自己有安装homebrew 安装 nginx brew install nginx 启动nginx 1.15版本下 安装是 直接在ngin ...
随机推荐
- Windows 10下使用WMware 12 安装Ubuntu16.04,安装过程(附全过程图)
序言:菜鸡的我又开始瞎搞Ubuntu了 首先在网下下载VMware 12 正常安装即可 关于产品密匙问题:5A02H-AU243-TZJ49-GTC7K-3C61N (这是我在网上找的密匙,反正自己是 ...
- 《DSP using MATLAB》Problem 5.31
第3小题: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Out ...
- 免费开源 KiCad EDA 中文资料收集整理(2019-04-30)
免费开源 KiCad EDA 中文资料收集整理 用 KiCad 也有一段时间了,为了方便自己查找,整理一下 KiCad 的中文资料,会不定期更新. 会收集KiCad 的新闻.元件封装库.应用技巧.开源 ...
- ML(附录2)——最小二乘法
参见 :多变量微积分笔记2——最小二乘法
- 【转】iOS编译OpenSSL静态库(使用脚本自动编译)
原文网址:https://www.jianshu.com/p/651513cab181 本篇文章为大家推荐两个脚本,用来iOS系统下编译OpenSSL通用库,如果想了解编译具体过程,请参看<iO ...
- webpack 3 升级到 webpack 4,遇到问题解决
报错:Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead 解 ...
- re正则匹配使用
print(result.span()) #输入字符串的范围 如果在匹配语句中有括号,group(1)就是提取第一个括号的内容,以此类推. 扩展思考:如果要从文本中匹配出目标字符串可以使用括号加gro ...
- 洛谷 3295 [SCOI2016]萌萌哒——并查集优化连边
题目:https://www.luogu.org/problemnew/show/P3295 当要连的边形如 “一段区间内都是 i 向 i+L 连边” 的时候,用并查集优化连边. 在连边的时候,如果要 ...
- spring-AOP框架(基于AspectJ注解配置AOP)
基于AspectJ注解配置AOP 1.加入jar包: 要在Spring应用中使用AspectJ注解,必须在classpath下包含AspectJ类库:aopalliance.jar.aspectj.w ...
- Excel文件转为其他格式文件
引用:Spire.XLS 是一个 Excel 文件的读写库,无需安装office,使用起来也挺方便的.Spire还有一些其他的库(Spire.Doc,Spire.Pdf……) 说明:Spire.XLS ...