Article ID: 126566, created on Aug 15, 2015, last review on Aug 17, 2015

  • Applies to:
  • Plesk Automation 11.5

Symptoms

  1. AWstats statistic page https://example.com/plesk-stat/webstat/ displays 404 "Not Found" error.

  2. /var/www/vhosts/system/example.com/statistic directory is missing on web hosting service node.

Cause

Web statistic directories are missing in /var/www/vhosts/system/example.com/statistic.

Resolution

  1. Recreate missing directories manually in /var/www/vhosts/system/example.com/statistic on Web hosting service node with following commands:

    mkdir -p /var/www/vhosts/system/example.com/statistics/anon_ftpstat
    mkdir -p /var/www/vhosts/system/example.com/statistics/ftpstat
    mkdir -p /var/www/vhosts/system/example.com/statistics/webstat
    mkdir -p /var/www/vhosts/system/example.com/statistics/webstat-ssl
    touch /var/www/vhosts/system/example.com/statistics/webstat-ssl/index.html
    touch /var/www/vhosts/system/example.com/statistics/webstat/index.html
    touch /var/www/vhosts/system/example.com/statistics/ftpstat/index.html
    touch /var/www/vhosts/system/example.com/statistics/anon_ftpstat/index.html
    
  2. Make sure Web statistic configuration files exist. For example, for domain example.com you can find AWstats configuration files in following directory (on Web hosting service node):

    /usr/local/psa/etc/awstats/awstats.example.com-anon_ftp.conf
    /usr/local/psa/etc/awstats/awstats.example.com-ftp.conf
    /usr/local/psa/etc/awstats/awstats.example.com-http.conf
    /usr/local/psa/etc/awstats/awstats.example.com-https.conf
    

    2.1. If it does not exist you can regenerate it by switching to another web statistic engine and back to original. Make sure that you have website logs, without log files it will be impossible to recalculate statistic.

  3. Create AWstats database files based on existing logs. Execute following commands on Web hosting service node:

    /usr/local/psa/admin/sbin/webstatmng --set-configs --stat-prog=awstats --domain-name=example.com
    /usr/local/psa/admin/sbin/webstatmng --calculate-rotated-statistics --stat-prog=awstats --domain-name=example.com
    
  4. Regenerate AWstats web-statistic pages. Execute following commands on Web hosting service node:

    /usr/local/psa/admin/bin/web_statistic_executor --calculate-domain example.com
    

Note: all commands should be run on the same Service node, where is web site is located.

Additionally if you need to fix this issue for multiple domains you can use the following steps:

  1. Create list of domains affected by this issue:

    # ls -ld /var/www/vhosts/system/*/statistics/webstat | awk  -F "/" '{ print $6}' > domwithstat.txt
    # ls -ld /var/www/vhosts/system/* | awk  -F "/" '{ print $6}' > alldoms.txt
    # grep -v -x -f domwithstat.txt alldoms.txt > statrepair.txt
    
  2. Recreate missing directories and files manually for all affected domains:

    # for i in `cat statrepair.txt` ; do mkdir -p /var/www/vhosts/system/$i/statistics/anon_ftpstat && mkdir -p /var/www/vhosts/system/$i/statistics/ftpstat && mkdir -p /var/www/vhosts/system/$i/statistics/webstat && mkdir -p /var/www/vhosts/system/$i/statistics/webstat-ssl ; done
    
    # for i in `cat statrepair.txt` ; do touch /var/www/vhosts/system/$i/statistics/webstat-ssl/index.html && touch /var/www/vhosts/system/$i/statistics/webstat/index.html && touch /var/www/vhosts/system/$i/statistics/ftpstat/index.html && touch /var/www/vhosts/system/$i/statistics/anon_ftpstat/index.html ; done
    
  3. Make sure Web statistic configuration files exist.

  4. Create AWstats database files based on existing logs:

    # for i in `cat statrepair.txt` ; do /usr/local/psa/admin/sbin/webstatmng --set-configs --stat-prog=awstats --domain-name=$i && echo $i ; done
    
    # for i in `cat statrepair.txt` ; do /usr/local/psa/admin/sbin/webstatmng --calculate-rotated-statistics --stat-prog=awstats --domain-name=$i ; done
    
  5. Afterwards regenerate AWstats web-statistic pages. Execute following commands on Web hosting service node:

    # for i in `cat statrepair.txt` ; do /usr/local/psa/admin/bin/web_statistic_executor --calculate-domain $i ; done
    

Search Words

statistics dont update

web statistic

recalculate statistic

web site statistics problem

Statistic page gives error

awstats

recalculate web stat

calculate statistics for one domain

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF