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

时间:2024-03-15 12:05:13

启动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文件

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

 

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

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

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

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

然后重启

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

 重启后,访问localhost,成功!

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