如何停止 Apache 服务器创建 error_log 文件?
有没有办法阻止 Apache 使用 .htaccess 创建 error_log 文件?
Is there a way to stop Apache creating error_log files using .htaccess ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了做一些有趣的事情之外,可能没有办法做到这一点,例如
您可以在 手动 该指令仅在服务器配置和虚拟主机中可用。如果您想删除特定 URL 的某些日志条目,您可以创建一个脚本来过滤这些行并使用类似的内容:
以同样的方式,您可以使用 this:
这不会避免拥有该文件,但它可能只有几行长或 0字节。此外,您不能使用
.htaccess
来实现这一点,您必须有权访问服务器配置。最后一点,我不太确定您打算做什么,但日志文件是有价值的安全信息,您可能需要它们,以防您必须调查某些问题、安全事件(黑客、审计)甚至统计数据。如果是日志太多的问题,我建议您看一下日志轮换软件,也许cronolog 将帮助您更好地管理它。
There is probably no way to do that apart doing something funny like
has you can see in the manual this directive is only available in a server config and a virtualhost. If you want to delete certain log entry for particular URLS, you can make a script that would filter those lines and use something like:
On the same fashion you can lower the log level to pretty much nothing with this:
this won't avoid having the file but it would be probably few lines long or 0 byte. Also you cannot use
.htaccess
to that, you have to have access to the server config.Last point, I am not really sure what you are intending to do but log files are valuable security information and you might need them in case you have to investigate some problems, security events (hack, audit) or even statistics. If it's a problem you have too much logs, I advice you to take a look at log rotation software, maybe cronolog would help you to manage it better.