homebrew安装nginx

默认homebrew下载路径太慢,需要替换镜像源(一、二、三步骤)

# 一、替换brew.git

cd "$(brew --repo)"
1
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
1

# 二、替换homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
1
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
1

# 三、更新

brew update
1

# 四、安装nginx

brew install nginx
1

# 五、查看nginx安装目录及配置文件目录

brew info nginx
1
  • 默认配置文件位置/usr/local/etc/nginx/nginx.conf

  • 默认加载访问资源位置/usr/local/var/www

# 六、nginx相关命令

# 启动nginx
brew services start nginx

# 重启nginx
brew services restart nginx

# 停止nginx
brew services stop nginx
1
2
3
4
5
6
7
8