for mac

intsall nginx

# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install nginx
brew install nginx

check configuration

brew info nginx

可以看到 Mac 下

  1. default root: /usr/local/var/www
  2. config: /usr/local/etc/nginx/nginx.conf

查看nginx的配置,可以在最后一行看到这句话 include servers/*;,意思是加载service下所有的配置文件,

那就好办了:直接创建一个services文件夹,然后将配置写在里面, 注意配置文件最好是 domain-port.conf的形式

记住每次修改配置文件都要:

sudo nginx -t
sudo nginx -s reload

关于mac上nginx的其他命令

# 第一次启动nginx
sudo nginx
# stop
sudo nginx -s stop

results matching ""

    No results matching ""