在 Centos 上将 Plesk 与 Apache 和 Nginx 一起使用。
错误被完美记录;
/var/www/vhosts/example.com/logs/error_log
/var/www/vhosts/example.com/logs/proxy_error_log
我通过删除和重新创建文件来截断文件;现在什么都没有记录。文件所有者和文件权限都一样;但错误记录刚刚停止。
我检查了其他域,它们都按预期完美运行。
实际上 Web 服务器日志存储在/var/www/vhosts/system/example.tld/logs/
.
记录中的文件/var/www/vhosts/example.tld/logs/
不是文件,而是硬链接到中的文件/var/www/vhosts/system/example.tld/logs/
。注意相同的 inode 编号 261064:
# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun 8 18:26 /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun 8 18:26 /var/www/vhosts/system/example.tld/logs/error_log
当我删除这个文件时,我已经删除了硬链接:
# rm /var/www/vhosts/example.tld/logs/error_log
rm: remove regular file `/var/www/vhosts/example.tld/logs/error_log'? y
# ls -lia /var/www/vhosts/system/example.tld/logs/error_log
261064 -rw-r--r--. 1 root root 2432 Jun 8 18:26 /var/www/vhosts/system/example.tld/logs/error_log
当我再次创建它时,它将拥有自己的 inode 编号 (276777):
# touch /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
276777 -rw-r--r--. 1 root root 0 Jun 8 18:33 /var/www/vhosts/example.tld/logs/error_log
因此,要解决您的问题,您只需要删除您创建的文件并在系统/日志中创建文件的硬链接:
# rm /var/www/vhosts/example.tld/logs/error_log
# ln /var/www/vhosts/system/example.tld/logs/error_log /var/www/vhosts/example.tld/logs/error_log
# ls -lia /var/www/vhosts/example.tld/logs/error_log
261064 -rw-r--r--. 2 root root 2432 Jun 8 18:33 /var/www/vhosts/example.tld/logs/error_log
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句