MacOS系统安装软件:python
macos系统下没有yum和apt-get命令,要安装软件须要使用homebrew。nginx
一、安装homebrew:git
安装:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
卸载:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"github
PS:若是出现ping github.com超时的状况,查找第三方ip,如192.30.253.112 github.com添加到/etc/hosts最后一行。macos
二、利用homebrew安装、卸载软件包:ruby
$ brew install pcre bzip2 openssl
$ brew uninstall python
$ brew search <packageName>
$ brew list 查看已安装
$ brew info <packageName> 查看包信息
$ brew -v
$ brew -h
$ brew install nginx 安装过程会本身安装依赖关系
$ brew services start nginx 启动nginx
$ brew services stop nginx 关闭nginx
$ brew services reload nginx 重启nginx
$ brew uninstall nginx 卸载nginxcurl
三、nginx文件目录结构:网站
nginx安装文件目录
(...网站路径)
/usr/local/Cellar/nginxurl
nginx配置文件路径
/usr/local/etc/nginx/nginx.conf日志
nginx日志文件路径
/usr/local/var/log/
nginx运行pid文件路径
/usr/local/var/run/
系统hosts文件位置
/private/etc/hosts
四、其余
注意事项:macos x系统对权限的约束很是严格,不能用root执行脚本;nginx.conf中user不能配置成root或macos,配置完会报错;运行时,目录属主:属组,属主须要改为conf中user的用户,默认nobody,属组改不了,默认staff(包含全部用户的组),可是即便如此,若是不配置属主,nginx并不生效,也就是说这个组没个卵用,目录配成777也没用。