在 Mac 上安装 NGINX
安装
brew update
brew install nginx
启动服务
brew services start nginx
Docroot is: /opt/homebrew/var/www
The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /opt/homebrew/etc/nginx/servers/.
To 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:
/opt/homebrew/opt/nginx/bin/nginx -g daemon\ off\;
- 编辑
/opt/homebrew/etc/nginx/nginx.conf修改端口号 - 编辑
/opt/homebrew/var/www/index.html修改默认页面
停止服务
brew services stop nginx
重启服务 brew services restar