• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Awstats + Centos /icons is not working

G

gomibaya

Guest
The awstats package in Centos4 and Plesk 8.1 used an alias dir for the icons:

/awstats-icon

But when the awstats contents is generated, the icon dir is different, instead /awstats-icon is /icon


To fix this issue, is neccesary to change this file:

/usr/share/awstats/awstats_buildstaticpages.pl

and change

my $DirIcons='';

with

my $DirIcons='/awstats-icon';
 
Good fix, thank you for sharing. Indeed this seems the best fix for the problem, just adding a new alias for /icons as said in some other threads is not a "clean way" imo as there is already a /awstats-icon alias... and just changing awstats config in /usr/local/psa/etc/awstats/ is not also a good fix as plesk may overwrite configuration... it is a shame how swsoft did this mistake and didn't released an hotfix to fix it yet, in fact latest hotfix is supposed to fix it but it doesn't... :(
 
just for the information of anyone who have this same problem.

my icons werent showing up (403 error)

the fix is simple, comment the allow from local(127.0.0.1)
Code:
Alias /awstats/icon/ /var/www/awstats/icon/

ScriptAlias /awstats/ /var/www/awstats/
<Directory /var/www/awstats/>
        DirectoryIndex awstats.pl
        Options ExecCGI
        order deny,allow
[b]#       deny from all[/b]
        allow from all [b]##127.0.0.1[/b]
</Directory>

#Alias /css/ /var/www/awstats/css/
#Alias /js/ /var/www/awstats/js/
 
From my /etc/cron.daily/50plesk-daily that I had to rename anyway, because Debian doesn't allow files with dots in the cron.daily directory:

## BALU: needed for awstats to allow changing of config dir
export AWSTATS_ENABLE_CONFIG_DIR=1

## BALU: Do some magic perl to replace DirIcons with the correct values
/usr/bin/perl -pi -e 's%DirIcons="/icon"%DirIcons="/awstats-icon"%i' /opt/psa/etc/awstats/awstats*.conf

## BALU: Our customers want German stats
/usr/bin/perl -pi -e 's%^Lang="auto"%Lang="de"%i' /opt/psa/etc/awstats/awstats*.conf
...

I have to wait for the cron run tomorrow to see if it works though ;)

Balu
 
Originally posted by JLChafardet
... the fix is simple, comment the allow from local(127.0.0.1)
Code:
Alias /awstats/icon/ /var/www/awstats/icon/

ScriptAlias /awstats/ /var/www/awstats/
<Directory /var/www/awstats/>
        DirectoryIndex awstats.pl
        Options ExecCGI
        order deny,allow
[b]#       deny from all[/b]
        allow from all [b]##127.0.0.1[/b]
</Directory>

#Alias /css/ /var/www/awstats/css/
#Alias /js/ /var/www/awstats/js/
What/where is the file this code is in please?

TIA
 
Better solution

I think that it would be better than editing the .pl file that generates al the awstats files, would be editing the template that is being used to generate those files.

To edit that template, you should edit the file /etc/awstats/awstats.model.conf and chenge the line that says:

DirIcons="/icon"

to

DirIcons="/awstats-icon"

Best regards,

Arnau Marcé
VPS - Servidores Dedicados - [url]www.silicontower.net[/URL]
 
Back
Top