我的服务器上只有32 up的空间,而日志很快就会消耗掉这些空间。所以我想禁用日志。
我想我已经知道该在哪里做了,但是因为我是一个完全的服务器新手,所以我不想在不确定它们不会使服务器崩溃的情况下开始改变事情。
在etc/apache2/apache2.conf中,我发现:
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent在etc/apache2/conf.d/other-vhost-access-log中,我找到了:
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined我需要做什么来禁用日志?
提前感谢
发布于 2012-05-29 15:20:54
如果您确实想禁用日志,则必须注释掉Apache配置文件中的任何ErrorLog和CustomLog指令。在Debian上,它们位于/etc/apache2/httpd.conf和/etc/apache2/apache2.conf (基本配置)中,然后是/etc/apache2/sites-available/* (特定虚拟主机配置)。
您可以通过在它们前面添加一个'#‘字符将它们注释掉。
更改完成后,运行/etc/init.d/apache2 restart以使更改生效。
由于日志通常非常方便,因此更好的解决方案是按照谢尔盖上面的建议安装日志轮换。在Debian中,运行以下命令:
sudo apt-get install logrotatelogrotate将在其默认配置中,每天拆分日志并压缩旧日志,在保留日志本身的同时节省大量磁盘空间。
发布于 2015-02-06 18:21:52
这里公认的答案是错误的。注释掉该行并不会禁用错误日志,它只是将其恢复为apache2默认值。从apache2 ErrorLog documentation
默认: ErrorLog日志/错误日志(Unix) ErrorLog日志/error.log (Windows和OS/2)
换句话说,这将位于apache安装根“logs”目录中的某个位置。
要禁用该功能,我认为您需要重新编译,而不需要日志记录支持(甚至不确定是否可能),或者通过管道将ErrorLog设置为/dev/null:
ErrorLog "|/dev/null"
https://stackoverflow.com/questions/10794612
复制相似问题