How To make awstats to generate static pages?

Dear Sirs!

I’ve been using awstats for a time, with one of it’s tools, called Because the virtualmin plugin didn’t contained it (or just I couldn’t find it), I already copied from another server.

My only problem is, that I can’t resolve, how can I add this feature for a domain, created with Virtualmin.

I’ve been looking through the code of, and I’ve found some lines:


generate_report(domain, handle, html-escape?)

Updates the AWstats report for a particular domain, from all of its

log files (or at least those that have changed since the last run)

sub generate_report
local ($dom, $fh, $esc) = @_;
local $user = &get_run_user($dom);
local $cmd = “$config{‘awstats’} -config=$dom -update”;

Can I add a piece of code somehow to manage to build static pages?
I don’t want to make this script collapse, so I was afraid to modify it, please help me.

Best regards,

@cadeyrn Did you find a solution to this? If yes, could you please share it.



I know it is an old question, but I just want to share the little “hacks” i’ve done in order to solve this issue. Hope it can help someone AND/OR virtualmin developers will consider to add in the official distribution AND/OR i can find the time to submit a proper patch:

  1. modify the script (usually you can find it in: /etc/webmin/ as follows:

=== BEGIN OF patch ===

open(CONF, “/etc/webmin/miniserv.conf”);
while() {
$root = $1 if (/^root=(.*)/);
$ENV{‘PERLLIB’} = “$root”;
$ENV{‘WEBMIN_CONFIG’} = “/etc/webmin”;
$ENV{‘WEBMIN_VAR’} = “/var/webmin”;
#print “eseguo…\n”;
system("$root/virtualmin-awstats/", @ARGV); # || die “Failed to run $root/virtualmin-awstats/ : $!”;

$domain_name = @ARGV[0];
$awstats_build="/usr/share/awstats/tools/ -config=$domain_name";

create dest directory and all its parents …

system(“mkdir -p $domain_awstats_dir”);

system($awstats_build); # || die “Error invoking ‘’: $!”;

system(“ln -fs $index_path index.html”);

=== END OF patch ===

(please, note that the exec(…) invocation have has been replaced with system, in order to continue in the execution after the first command …)

  1. add to your virtual host configuration an entry such as the following:

    Alias /statistics/webstat /var/www/vhosts/<your_domain_name>/statistics/webstat

  2. now you should be able to access your statistics via webbroser using the following url:


Hope it helps, and I’m open to further suggestions :slight_smile: