[emerg] open() “/usr/local/Cellar/nginx/1.17.10/logs/error.log“ failed (2: No such file or directory

启动nginx时报:[emerg] open() "/usr/local/Cellar/nginx/1.17.10/logs/error.log" failed (2: No such file or directory)

解决办法是去/usr/local/Cellar/nginx/1.17.10/ 目录下,先创建logs目录,然后再新建error.log文件

启动nginx时报:[warn] 1024 worker_connections exceed open file resource limit: 256

 worker_connections: 单个后台worker process进程的最大并发链接数worker_connections;

控制台执行:ulimit -a,显示如下,将红色字的变量改为1024即可,使用命令ulimit -n 1024。

然后重启

重启时报:nginx: [error] open() "/usr/local/Cellar/nginx/1.21.4/logs/nginx.pid" failed (2: No such file or directory)

使用nginx -c的参数指定nginx.conf文件的位置

找到nginx 的bin目录,然后输入pwd复制文件目录加上nginx

输入:sudo /usr/local/Cellar/nginx/1.21.4/bin/nginx -c /usr/local/etc/nginx/nginx.conf

 进入logs目录,查看,已经生成好了,然后重启nginx

 

 重启后,访问localhost,成功!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值