Applicable to:
- Plesk for Linux
Symptoms
-
AWStats page does not display images and graphs.
-
FireBug shows
404 Not Found
error for all images. -
The following errors could be found in
/var/www/vhosts/system/example.com/logs/error_log
:CONFIG_TEXT: [authz_core:error] [pid 6138] [client 203.0.113.2:1505] AH01630: client denied by server configuration: /usr/share/awstats/wwwroot/icon/browser/unknown.png, referer: https://example.com/plesk-stat/webstat/current/index.html
[authz_core:error] [pid 6125] [client 203.0.113.2:1506] AH01630: client denied by server configuration: /usr/share/awstats/wwwroot/icon/browser/pdaphone.png, referer: https://example.com/plesk-stat/webstat/current/index.html -
Fail2ban bans IP addresses that try to access files mentioned in errors.
Cause
The incorrect document directory path is configured for AWStats.
Custom Nginx directives preventing images from being served properly.
Resolution
-
Connect to the server via SSH.
-
Check the AWSTATS directives in the
/etc/psa/psa.conf
file and correct them as follows (if necessary):Debian/UbuntuCONFIG_TEXT: AWSTATS_ETC_D /etc/awstats
AWSTATS_BIN_D /usr/lib/cgi-bin
AWSTATS_TOOLS_D /usr/share/awstats/tools
AWSTATS_DOC_D /usr/share/awstatsCentOS 7/8In Plesk version 18.0.45 and earlier:
CONFIG_TEXT: AWSTATS_ETC_D /etc/awstats
AWSTATS_BIN_D /var/www/cgi-bin/awstats
AWSTATS_TOOLS_D /usr/share/awstats
AWSTATS_DOC_D /var/www/html/awstatsIn version 18.0.46 and newer:
CONFIG_TEXT: AWSTATS_ETC_D /etc/awstats
AWSTATS_BIN_D /usr/share/awstats/wwwroot/cgi-bin
AWSTATS_TOOLS_D /usr/share/awstats/tools
AWSTATS_DOC_D /usr/share/awstats/wwwroot -
Run the following command to update AWStats configuration values in Plesk database:
# plesk sbin packagemng -sdf
-
Recreate configuration files for webserver:
# plesk repair web -domains-only
Note: Depending on the number of websites hosted on your server execution of this utility may take some time and Apache will be restarted.
Note: If there are custom Nginx directives used, make sure that they do not prevent images from being served properly.
Comments
21 comments
It worked for me, but with a slightly different approach:
- In my case, the AWSTATS_DOC_D in /etc/psa/psa.conf was wrong, so I had to change it between step 1 and step 2.
- Then, instead of editing /etc/httpd/conf/httpd.conf, I've added the lines in step 4 to /etc/httpd/conf.d/awstats.conf
Hello @Alban, thank you for sharing your case.
Adjusting AWSTATS_DOC_D is included in step 2.
As for modifying /etc/httpd/conf.d/awstats.conf instead of /etc/httpd/conf/httpd.conf, it is a valid variation of the provided solution.
Hi @ all,
I've got the same problem as Alban in my case AWSTATS_DOC_D was pointing to /var/www/html/awstats so we changed it in /etc/psa/psa.conf.
Also, we changed the path in /etc/httpd/conf/httpd.conf, with the right entries : /usr/share/awstats/wwwroot/icon and /usr/share/awstats/wwwroot/css in step 4.
We did also a restart of the httpd daemon but it still points to /var/www/html/awstats and the FireBug shows
404 Not Found
error for all images.Any Idea why it ignores our changes?
Greetings Chris
@ wp4all
Hi Chris! Please also check /etc/httpd/conf.d/awstats.conf and /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf (even though the latter should be recreated after Apache restart), these files can also point awstats to another folder.
Please review the case distinction in "Resolution" section (2.). In the CentOS 7 default installation with Plesk, AWStats is not located in /var/www/html, but in /usr/share/awstats/wwwroot. The section asks "For CentOS 7 use the following values:"
AWSTATS_DOC_D /var/www/html/awstats
But that is not what you want to use, it is what the wrong state is. The correct variable setting ("... use the following values:") should read
AWSTATS_DOC_D /usr/share/awstats/wwwroot
Hi @Peter Debik,
Thank you for the feedback!
I checked the configuration files on my test environments and updated the article with new info
I found that on several of our out-of-the-box Plesk installations, a part that is needed in /etc/httpd/conf/httpd.conf was missing:
<Directory "/usr/share/awstats/wwwroot/icon">
AllowOverride None
Require all granted
</Directory>
<Directory "/usr/share/awstats/wwwroot/css">
AllowOverride None
Require all granted
</Directory>
This must be present in /etc/httpd/conf/httpd.conf, else the icons of AWstats wont's display.
Hello @Peter,
Please, let me know the OS and Plesk version, we'll try to reproduce it on a test set.
CentOS 7.7, Plesk Onyx, latest MU installed.
Hello @Peter,
I have just checked on a fresh Onyx installation and there is no such directives. The path "/usr/share/awstats/wwwroot" also seems to be non-default. Web files of AWstats are located at "/var/www/html/awstats".
The directives itself does not look like required for icons display. Probably they appeared due to customized web path.
A possible explanation could be that the hosts are coming from 12.x installations. I am sure we have never changed the paths (we never change default paths anyway).
@Peter Debik I suppose that awstat was installed from the wrong repository, please check its packager.
It is a good idea, but we are using nothing but the original CentOS, Plesk and MariaDB repositories. No machine here is using anything else. It is all absolutely authentic from the original repositories. AWStats was auto-installed by Plesk on all machines. There have never been any customizations from our side. The reason for that strategy here is, that we must make sure that all systems are in sync and have the "perfect" configuration that the vendor suggests to avoid any such issues as described herein.
@Peter Debik
Let me check if the issue is reproduced in an upgrade scenario.
@Peter Debik
I have double-checked the paths on test installations and updated them in the article; they are the same for CentOS 6 and 7.
Regarding the Apache configuration directive in /etc/httpd/conf/httpd.conf - it has not appeared, either. It is also not required for AWStats to function. Seems like it was used as a workaround of some kind.
My initial test installation was Plesk 12.0, then I upgraded it to 12.5 - 17.0 - 17.5 - 17.8. The Apache directives have not appeared during the process. I have also removed the corresponding step from the article.
Confirming @Peter Debik's finding:
With Plesk Obsidian Version 18.0.29 Update #3 (updated from Onyx) under CentOS Linux 7.8 the correct setting for AWSTATS_DOC_D is /usr/share/awstats/wwwroot
# cd /var/www/html/awstats
-bash: cd: /var/www/html/awstats: No such file or directory
Hi Sergio Manzi!
Can you let me know the output of the following commands:
Hello @...!
Sorry, my configuration has changed in the meanwhile as I decided to reinstall awstats from the Plesk repo as detailed in https://support.plesk.com/hc/en-us/articles/213930765-AWStats-web-statistics-page-does-not-work-as-expected
I intended to update here, but then I was caught into some family issues and eventually forgot to do it, sorry.
Anyway I think you can get some meaningful information from my logs:
As you can see, at the time of my above post awstats was version 7.8-1 from the el7 repo, while I'm now using 7.7-2 from the Plesk repo as confirmed from the output of "rpm -qi awstats":
With Plesk's awstats the correct (working) awstats configuration in
/etc/psa/psa.conf
is the one indicated in this article (in the CentOS section, of course):Everything is fine now: I'm only wondering what I'm loosing (if any) using awstats 7.7-2 instead of 7.8-1...
I have an hunch (but can't vow on that...) that me originally having the el7 repo version instead of the Plesk's repo version could derive from the fact that my Plesk installation was initially an Onyx one, eventually upgraded to Obsidian...
Cheers and thanks from taking care of the issue,
Sergio
Sergio Manzi
Thank you for confirming that everything is fine now.
To be honest, it's difficult to say what is the difference between 7.7 and 7.8 because even their official page with ChangeLog does not contain any information about 7.8 - https://awstats.sourceforge.io/docs/awstats_changelog.txt.
I think you had 7.8 version in the past because it is the version that is available in EPEL repo, Plesk Onyx uses awstats installed from OS repos. Starting from Obsidian, Plesk ships its own awstats package.
Had the same issue here on CentOS 8 with awstats 7.8 being installed from repo. Fixed it with the notes above and these commands:
rpm -e awstats
yum-config-manager --disable epel
plesk installer --select-release-current --install-component awstats
Jordan Schelew
Thank you for your comment. It might be useful for other Pleskians that have AWStats installed from the EPEL repo.
Please sign in to leave a comment.