根本原因是因为

 brew install nginx
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.15.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/yuepeng1/Library/Caches/Homebrew/nginx-1.15.1.high_sierra.bottle.tar.gz
==> Pouring nginx-1.15.1.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.1: 23 files, 1.4MB

看最下面

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

主要是先运行它 brew services start nginx
这样的话nginx自启开启,然后在run nginx
这样localhost or 127.0.0.1就能访问进去了
具体nginx配置你们自行配置,我是直接修改的nginx.conf中的文件,然后配置的自文件,这样可以多配置n个二级域名

GitHub 加速计划 / br / brew
40.41 K
9.47 K
下载
🍺 The missing package manager for macOS (or Linux)
最近提交(Master分支:1 个月前 )
90a90b30 3 个月前
47b1cab7 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐