指引网

当前位置: 主页 > 服务器 > Apache >

Apache2关闭 VirtualHost的Log日志记录

来源:网络 作者:佚名 点击: 时间:2017-06-18 20:46
[摘要]  有时我们的apache产生的日志是超大的并且 没什么用处,这时我们就可以关闭了,关闭apache日志很简单,直接ErrorLog off或 # CustomLog即可。

 

Web server(ex: Apache2、Nginx..) 的存取留下 Log 可以观察很多东西、追踪、找问题 等等, 但是量太大的时候, 另外一个困扰也会出现, IO 吃紧, Loading 随著?高.

查官方网页的说明: Log Files - Apache HTTP Server, 居然找不到关闭的方法. XD

於 Apache2 想要将 VirtualHost 内某个 Domain 的 Log 记录关掉, 要如何做呢?


Apache2 关闭 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>

------分隔线----------------------------