您的位置:首页 > 运维架构 > Apache

Apache关闭VirtualHost的Log日志记录

2016-05-09 15:42 302 查看
有时我们的apache产生的日志是超大的并且 没什么用处,这时我们就可以关闭了,关闭apache日志很简单,直接ErrorLog off或 # CustomLog即可。

Web server(ex: Apache2、Nginx..) 的存取留下 Log 可以观察很多东西、追踪、找问题 等等, 但是量太大的时候, 另外一个困扰也会出现, IO 吃紧, Loading 随著?高.
查官方网页的说明: Log Files - Apache HTTP Server, 居然找不到关闭的方法. XD
於 Apache2 想要将 VirtualHost 内某个 Domain 的 Log 记录关掉, 要如何做呢?

Apache 关闭 VirtualHost 的 Log 记录 方法
想将 Apache2 VirtualHost 的 Log 记录关掉, 主要是下面两行:
■ErrorLog off # 关掉 Error Log 记录
■CustomLog /dev/null combined # 关掉 Access Log 记录
范例

<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/
# ErrorLog /var/log/apache2/error.log
# CustomLog /var/log/apache2/access.log combined
ErrorLog off
CustomLog /dev/null combined
</VirtualHost>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: