brew安装nginx

2018-09-03  本文已影响19人  sprainkle

安装nginx

brew install nginx
==> Installing dependencies for nginx: pcre
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.42.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre-8.42.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/pcre/8.42: 204 files, 5.3MB
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.15.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring nginx-1.15.2.high_sierra.bottle.tar.gz
==> 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
==> Summary
🍺  /usr/local/Cellar/nginx/1.15.2: 23 files, 1.4MB
==> Caveats
==> 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 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服务

brew services start nginx
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 14 (delta 0), reused 7 (delta 0), pack-reused 0
Unpacking objects: 100% (14/14), done.
Tapped 1 command (43 files, 55.2KB).
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)

最后访问: http://localhost:8080/
若看到 Welcome to nginx!即代表安装并启动成功。

nginx文件目录

nginx常用命令

nginx  #启动nginx
nginx -s quit  #快速停止nginx
nginx -V #查看版本,以及配置文件地址
nginx -v #查看版本
nginx -s reload|reopen|stop|quit   #重新加载配置|重启|快速停止|安全关闭nginx
nginx -h #帮助

卸载nginx

brew uninstall nginx
上一篇下一篇

猜你喜欢

热点阅读