Apache关闭VirtualHost的Log日志记录

有时我们的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>

posted on 2016-05-09 15:42  zqifa  阅读(595)  评论(0编辑  收藏  举报

导航