Website Migration Notice: SafePoint is now operated by CyberServal.Learn more →
Discussion

[Suggestion] initialization script create the "/usr/local/nginx/html" directory

Discussion Closed

Published 2 years ago

# Github Issue
# question

Published 2 years ago

profile_photo

dominicx

Updated 2 years ago

0

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

profile_photo

xbingW

Updated 2 years ago

0

为啥需要往这个 /usr/local/nginx/html 写

profile_photo

dominicx

Updated 2 years ago

0

为啥需要往这个 /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。

profile_photo

Lvshujun0918

Updated 2 years ago

0

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"
同样的问题

profile_photo

StayerYao

Updated a month ago

0

感谢反馈。经确认,该报错仅在手动将 access_log 配置为包含日期等变量的动态路径时触发;默认生成的访问日志配置使用固定路径,不依赖 /usr/local/nginx/html,不会影响正常的防护和代理功能。

对于自定义的 Nginx 日志配置,建议显式设置一个已存在的 root,或自行创建 /usr/local/nginx/html;日志轮转则建议使用雷池内置能力或系统的 logrotate。

由于该场景不属于默认配置,当前暂无计划在镜像中额外创建此目录,因此先关闭该 Issue。如果默认配置下仍能复现,欢迎提供版本和复现步骤,我们再重新评估。