Install awstats on a raspberry pi

First install awstats on your raspberry pi

sudo apt-get install awstats

Then change your lighttpd configuration

sudo nano /etc/lighttpd/lighttpd.conf
server.modules = ( 
"mod_accesslog",
"mod_fastcgi", 
"mod_status", 
"mod_cgi", 
"mod_rewrite" ) 
$HTTP["host"] =~ "awstats.YOURDOMAINNAMEHERE" {
cgi.assign = (
".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl"
)
server.document-root = "/home/pi/www/production/awstats/"
}

Then check the Syntax of your lightttpd.conf

sudo lighttpd -t -f /etc/lighttpd/lighttpd.conf

Now change the awstatd.conf

sudo nano /etc/awstats/awstats.conf

Change the LogFile variable to point to the lighttpd log file

LogFile="/var/log/lighttpd/access.log"

Change the LogFormat to the log settings for lighttpd

LogFormat="%host %virtualname %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
DirData="/home/pi/www/production/awstats"

Edit /etc/lighttpd/lighttpd.conf and remove .pl from the list of excluded extensions.

create an cgi-bin directory in your www Dir and copy the awstats.pl into it change the rights with chmod to 755

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

Now restart the lighttp Webserver

sudo /etc/init.d/lighttpd restart

Update the awstats Statistics

sudo /usr/lib/cgi-bin/awstats.pl -update -config=raspberry.redbrain.me

On my setup it was necessary to enable the fastcgi mode in lighttpd

sudo lighttpd-enable-mod fastcgi

Links:

Last generation on 2024-10-06 00:00:52.


© 2024 Oliver Graute ⋅ hosted on a Raspberry PI ⋅ EmailMastodonTwitterGithubStackoverflowFlickr