AWStats ist ein potent Open-Source-Webanalyse-Tool für detaillierte Einblicke in Website-Aktivitäten. Dieses Tutorial bietet eine Anleitung zur Installation und Nutzung von AWStats, um Website-Traffic effektiv zu analysieren und zu optimieren.

Paket installieren

apt install awstats

Konfigurieren

cd /etc/awstats
cp awstats.conf awstats.domainname.conf

Die Datei awstats.domainname.conf öffnen und anpassen.
Wichtig ist hier, dass die richtige Apache Logdatei eingestellt wird die AWstats auswerten soll.

AWStats aktualisieren

/usr/lib/cgi-bin/awstats.pl -config=domainname -update

Siehe auch /etc/cron.d/aswstats

CGI Zugriff einrichten

#####################################################################
### AWSTATS                                                       ###
#####################################################################
 
# This provides worldwide access to everything below the directory
# Security concerns:
#  * Raw log processing data is accessible too for everyone
#  * The directory is by default writable by the httpd daemon, so if
#    any PHP, CGI or other script can be tricked into copying or
#    symlinking stuff here, you have a looking glass into your server,
#    and if stuff can be uploaded to here, you have a public warez site!
<Directory /var/lib/awstats>
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>
 
# This provides worldwide access to everything in the directory
# Security concerns: none known
Alias /awstats-icon/ /usr/share/awstats/icon/
 
# This provides worldwide access to everything below the directory
# Security concerns: none known
<Directory /usr/share/awstats/icon>
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>
 
# This (hopefully) enables _all_ CGI scripts in the default directory
# Security concerns: Are you sure _all_ CGI scripts are safe?
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 
RedirectMatch ^/logs    /cgi-bin/awstats.pl?config=domainname
 
#####################################################################
### AWSTATS ENDE                                                  ###
#####################################################################

Cron einrichten

cd /etc/cron.d/
touch awstats

Inhalt des Cron Jobs für AWstats

3,33 * * * * root /usr/lib/cgi-bin/awstats.pl -config=domainname -update >/dev/null

Berechtigung für www-data

chown root:www-data /etc/awstats/awstats.domainname.conf
chmod g+w /etc/awstats/awstats.domainname.conf

GeoIP

Damit GeoIP funktioniert müssen folgende Pakete installiert werden

apt install geoip-bin geoip-database libgeo-ip-perl libgeo-ipfree-perl

Die GeoIP Plugins können in der AWstats Konfigurationsdatei aktiviert werden. Es gibt bei http://www.maxmind.com/app/ip-location kostenlose Lite Versionen von GeoIPCountry und GeoIPCity. Einfach runterladen, entpacken und in den ensprechenden Ordner packen.

Abschließend immer update ausführen

/usr/lib/cgi-bin/awstats.pl -config=domainname update

URL alias builder