Mac下安装nginx
来自: https://blog.csdn.net/czjlghndcy/article/details/84398207
1.安装HomeBrew(https://brew.sh/)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装nginx
brew install nginx
3.启动nginx
brew services start nginx
4.打开配置文件,打开local/etc/nginx/ngix.conf添加如下配置
location / {
add_header Access-Control-Allow-Origin *;
}
5.停止nginx(nginx -h 查看nginx命令)
nginx -s stop
注意: 如果localhost:8080打不开,请访问127.0.0.1:8080
另:如果找不到Macintosh HD ,Cmd+⬆️,找到后拖动到Dock;
打开隐藏文件夹,Cmd + shift + G