Open dominicx opened 1 month ago
为啥需要往这个 /usr/local/nginx/html 写
为啥需要往这个 /usr/local/nginx/html 写
不是要往这个目录写东西。是如果开启记录访问日志,如果日志路径需要按日期分割的时候 nginx检查了这个目录存不存在。
during each log write the existence of the request’s is checked, and if it does not exist the log is not created.
因为没有设置root,默认root目录是/usr/local/nginx/html。
2024/08/20 13:11:28 [error] 158#0: *74504 testing "/usr/local/nginx/html" existence failed (2: No such file or directory) while logging request, client: 112.10.238.214, server: ai.cszj.wang, request: "GET /_next/static/chunks/55244-ef36656f36a5b038.js HTTP/2.0", upstream: "http://127.0.0.1:40247/_next/static/chunks/55244-ef36656f36a5b038.js", host: "ai.cszj.wang", referrer: "https://ai.cszj.wang/sw.js" 同样的问题
What would you like to be added or improved?
当我们在nginx.conf启用日志按日期写入的时候,就会报错“[error] 101#0: *101 testing "/usr/local/nginx/html" existence failed (2: No such file or directory) while logging request,”。 原因是ngx_http_log_module模块会检查root配置目录是否存在。 具体参考:ngx_http_log_module 中 “during each log write the existence of the request’s root directory is checked, and if it does not exist the log is not created. It is thus a good idea to specify both root and access_log on the same configuration level:” 所以建议在镜像脚本中建立/usr/local/nginx/html目录
Why is it needed?
No response