brew update
brew search nginx

# 如果安装,报错:Error: Failure while executing; `tar --extract --no-same-owner --file
# /Users/xxx/Library/Caches/Homebrew/
# downloads/2c92bd4234d682c86f85120598f6801772112cf7835ab4b70ce00dcbd9718aa1--pcre-8.45.ar
# m64_big_sur.bottle.tar.gz --directory /private/tmp/d20210813-54722-1c0d6n0` exited with 1. 
# 以上报错,那么需要手动执行:brew install pcre
brew install nginx
说明 路径
nginx配置路径(conf等文件) /opt/homebrew/etc/nginx
nginx中的日志 /opt/homebrew/var/log/nginx
nginx中访问默认首页地址 /opt/homebrew/var/www
nginx -version

# 启动nginx(如果要指定配置:nginx -c xxx.conf),启动后的默认端口为8080
nginx

# 查看nginx是否启动(查看进程是否存在)
ps -ef|grep nginx

nginx -s stop

nginx -s reload

 

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐