1.包管理器安装nginx
brew install nginx
2.启动服务
直接在命令行输入nginx、此时可以打开浏览器输入localhost、能看到欢迎界面代表启动成功
3.查看nginx进程
ps -ef|grep nginx
4.查看指定端口占用情况
lsof -i:80
5.停止nginx
nginx -s stop
6.查看nginx信息
nginx -V
其中--prefix是根目录、--conf-path是配置目录
也可以使用nginx -t来查看上面两个目录
其中根目录下的html文件夹下的index.html就是打开localhost看到的默认页面
7.将你的页面移动到默认html目录下
cp -rf * /opt/homebrew/var/www/