Apache 日志不再起作用

Apache 日志不再起作用

我发现我的 /var/log/apache2/error.log 日志变得非常大(当我 cat 文件或在编辑器中打开时运行很长时间)。所以我用 rm 删除了它。它不仅现在不起作用,而且当我重新创建文件并 chmod 777 时也不起作用。我该如何重新启用它?

我尝试重新启动 apache,但出现以下错误:

$ service apache2 restart
 * Restarting web server apache2                                                                                                                                                      /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

答案1

Apache 仍在写入已删除的文件,直到 Apache 停止后,该文件才真正被删除。

要重新启动 Apache,您需要root

sudo service apache restart

相关内容