Symptoms
-
Statistics for previous months can not be checked in Plesk > Domains > example.com > Web Statistics SSL/TLS. The error message is provided in a browser:
Server Error 403 Forbidden
You do not have permissions to access this document -
In the
/var/www/vhosts/system/example.com/logs/error_log
the error message exists:AH00037: Symbolic link not allowed or link target not accessible: /var/www/vhosts/system/example.com/statistics/webstat-ssl/2021-02/index.html, referer: https://example.com/plesk-stat/webstat-ssl/nav.html
-
The file
/var/www/vhosts/system/example.com/statistics/webstat-ssl/2021-02/index.html
is a symlink to/var/www/vhosts/system/example.com/statistics/webstat-ssl/2021-02/awstats.example.com-https.html
which doesn't exist:# ls -la /var/www/vhosts/system/example.com/statistics/webstat-ssl/2021-02/
total 0
drwxr-xr-x. 2 root root 24 Feb 28 06:20 .
drwxr-xr-x. 5 root root 238 Apr 25 03:37 ..
lrwxrwxrwx. 1 root root 33 Feb 28 06:20 index.html -> awstats.example.com-https.html
Cause
Missing source file for a symbolic link
Resolution
Regenerate statistic for the domain
Warning: Before using the script to regenerate statistics it is strongly advised to create a backup of the subscriptions containing the domains the script will be used for.
If both, Apache and nginx are enabled and the following script is executed, logs processed by this script will not be sorted by timestamp, which can lead to incorrect values in resulting AWStats statistics.
-
Connect to a Plesk server via SSH
-
Download the script:
# wget https://raw.githubusercontent.com/plesk/kb-scripts/master/rebuild-awstats/rebuild-awstats.sh
-
Grant execute permissions for the script:
# chmod 755 rebuild-awstats.sh
-
Regenerate statistics from txt files using "-R" option or from existing logs using "-F"
# ./rebuild-awstats.sh -R example.com
After recreation is complete, recalculate the statistic using this instructions.