macOS 安装 nginx

101 篇文章 8 订阅

最近系统重装,记录一下安装过程吧。

brew install nginx

安装就是这么简单。

查询配置文件位置

nginx -t

结果如下:

itkey@itkeydeMacBook-Pro ~ % nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

修改配置以后重启 nginx

nginx -s reload

重启报错解决办法

服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错

nginx: [error] invalid PID number “” in “/run/nginx.pid”

解决方法:

需要先执行

nginx -c /etc/nginx/nginx.conf

nginx.conf文件的路径可以从nginx -t的返回中找到。

nginx -s reload

参考文档

https://blog.csdn.net/achang21/article/details/80039561

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要在macOS安装nginx,你可以按照以下步骤进行操作: 1. 首先,请确保已经安装了Homebrew。如果没有安装,请参考常见问题部分的指南来安装Homebrew。 2. 使用以下命令安装nginx:brew install nginx。这将会下载并安装nginx。 3. 安装完成后,可以使用nginx -v命令来查看已安装nginx版本。 4. 要启动nginx,可以使用命令nginx。 5. 如果想要关闭nginx,可以使用命令nginx -s stop。 6. 如果需要重新加载nginx配置文件,可以使用命令nginx -s reload。 7. 在安装过程中,可能会遇到端口被占用的问题。如果出现类似于"bind() to 0.0.0.0:80 failed (48: Address already in use)"的错误提示,这意味着端口80已经被其他进程占用了。 #### 引用[.reference_title] - *1* *2* [关于MacOSNginx安装及配置](https://blog.csdn.net/BSSMWYT/article/details/122767822)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [Mac 安装 Nginx](https://blog.csdn.net/speedwalkman/article/details/130723412)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值