我从awstats得到这个通知:
Error while processing /etc/awstats/awstats.conf Create/Update database for config "/etc/awstats/awstats.conf" by AWStats version 7.4 (build 20150714) From data in log file "/var/log/apache2/access.log"... Error: Couldn't open server log file "/var/log/apache2/access.log" : Permission denied Setup ('/etc/awstats/awstats.conf' file, web server or permissions) may be wrong. Check config file, permissions and AWStats documentation (in 'docs' directory).
但是,我没有看到权限的任何错误:
> ls -l /var/log/apache2/access.log -rw-r--r-- 1 root adm 62438 Sep 30 09:51 /var/log/apache2/access.log > ls -ld /var/log/apache2 drwxr-xr-x 2 root root 12288 Sep 30 06:25 /var/log/apache2/ > ls -ld /var/log drwxr-xr-x 20 root root 4096 Sep 30 06:25 /var/log/ > ls -ld /var drwxr-xr-x 13 root root 4096 Sep 23 14:39 /var/
我在这里错过了什么?
编辑更多的澄清:
这个错误是由awstats cron作业引发的。 cron作业的内容是:
> cat /etc/cron.d/awstats MAILTO=root */10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh # Generate static reports: 10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
所以这个工作是由用户www-data
运行的。
www-data
应该具有对文件的读取权限; 当我运行sudo -u www-data less /var/log/apache2/access.log
它工作正常。
awstats是否需要向日志文件写入权限? 这似乎很奇怪,它会需要它,但我找不到任何文件绝对告诉我这样或那样。
这是一个:
也许你的apache不是以root的身份运行的:adm和进程想要写入它?