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