反馈请联系hertz@hertzwang.com,谢谢
安装brew(Homebrew)
一般默认装有brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew常用命令:
- 搜索软件:
brew search nginx - 卸载软件:
brew uninstall nginx - 升级brew:
sodu brew update - 查看安装信息:
sodu brew info nginx - 查看已经安装的软件:
brew list - 注:脚本会在执行前暂停,按下回车并输入管理员密码。更多信息查看官方网站
安装Nginx
$ brew install nginx
nginx常用命令:
- 启动
nginx服务:sudo brew services start nginx - 关闭
nginx服务:sudo brew services stop nginx - 重新加载
nginx:nginx -s reload - 停止
nginx:nginx -s stop - 检查配置文件语法:
nginx -t
注:也可使用sudo nginx启动、使用sudo nginx -s stop停止。
Nginx相关信息
- 部署路径:
/usr/local/var/www nginx配置文件路径:/usr/local/etc/nginx/nginx.conf- 默认使用
8080端口
执行 brew info nginx 后得到以下信息
nginx: stable 1.12.0 (bottled), devel 1.13.2, HEAD
HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
https://nginx.org/
/usr/local/Cellar/nginx/1.12.0_1 (23 files, 1MB) *
Poured from bottle on 2017-07-08 at 18:27:37
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/nginx.rb
==> Dependencies
Required: pcre ✔, openssl@1.1 ✔
Optional: passenger ✘
==> Options
--with-debug
Compile with support for debug log
--with-gunzip
Compile with support for gunzip module
--with-passenger
Compile with support for Phusion Passenger module
--with-webdav
Compile with support for WebDAV module
--devel
Install development version 1.13.2
--HEAD
Install HEAD version
==> Caveats
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 now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx
nginx.conf
1 |
|