Posts Tagged ‘AWStats’

Plesk AWStats view statistics for all domain

June 8th, 2010 No comments

By default in Plesk you can view AWstats statistics for each domain separately at http://<yourdomain>/webstat . And you must type here FTP password for the domain. It’s not comfortably when your server holds much more than one domain.

So, our task is to create superadmin-access for AWStats for viewing all domains statistics with only one password.

First of all, find you file. It must be located in cgi-bin directory which lies near your vhosts. In my case it’s /srv/www/cgi-bin

Put here 2 files:


AuthUserFile /srv/www/cgi-bin/.htpasswd
AuthName "AWStats"
AuthType Basic
require valid-user


use strict;
use warnings;

use CGI qw(:standard);

print header;
print start_html(-title => 'AWStats');

opendir (DIRH, '/usr/local/psa/etc/awstats') || die; # path depends on your system

print '<div align="center">';

my $file; my @files;
# awstats config files are named like awstats.<yourdomain>-http.conf
# if you need to see also ftp etc, modify my code
while ($file = readdir DIRH) {
 $_ = $file; # my perl doesn't works without assignment result of readdir
 next unless m/\-http\.conf$/;
 push @files, $file;

for $file (sort @files) {
 $_ = $file;
 print "<a target='_blank' href='",$_,"'>";
 print '</a><br>';

print "</div>";

Don’t forget to chmod +x

To finish with this dir, create .hpasswd file:

htpasswd -c .htpasswd <username>

At last you need to config Apache web-server.

Put in /etc/apache2/conf.d/awstats.conf (or create a new one):

ScriptAlias /awstats-full /srv/www/cgi-bin
Alias  /awstats-icon /usr/share/apache2/icons/awstats

<Directory /srv/www/cgi-bin>
 AllowOverride All

Please check all paths, they are depend on your system. For exampe, apache config dir may be /etc/httpd/

Finally, restart Apache graceful (recommended)

apachectl -k graceful

or restart fully

apachectl -k restart

Now you can see all domain statistics on http://<your ip>/awstats-full/

Categories: Linux, Plesk Tags: , , , ,