I started to use awstats for creating the site statistics on our server. After installing the ubuntu package, there are still a few things that I had to do:
Download
http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz
http://www.maxmind.com/download/geoip/api/perl/Geo-IP-1.27.tar.gz
http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
http://www.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
in order to use the free, but non-open source versions of GeoIP.
LogFile="/var/log/apache2/jeltsch.org/access.log"
LogFormat=1
DNSLookup=1
SiteDomain="jeltsch.org"
HostAliases="www.jeltsch.org"
AllowToUpdateStatsFromBrowser=1
AllowFullYearView=3
EnableLockForUpdate=1
AllowAccessFromWebToAuthenticatedUsersOnly=1
AllowAccessFromWebToFollowingAuthenticatedUsers="jeltsch"
DefaultFile="index.html index.php"
LoadPlugin="geoipfree"
If you want to use the non-OSS GeoIP stuff, replace the last line by the following:
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoLiteCity.dat"
LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/share/perl/5.8.8/Geo/IP/GeoIPASNum.dat"
Compile the GeoIP-1.4.2 stuff according to the INSTALL file. You probably need to get some stuff first to be able to do the compilation. Execute apt-get install build-essential
Compile Geo-IP-1.27 according to the INSTALL file. Unzip the 3 databases and put them into the /usr/local/share/perl/5.8.8/Geo/IP/ directory.
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
AuthType basic #added line
AuthName "cgi-bin restricted" #added line
AuthUserFile /etc/apache2/.htpasswd #added line
<Files awstats.pl> #added line
Require valid-user #added line
</Files> #added line
</Directory>
The you need to create the /etc/apache2/.htpasswd file and add a user password with the command:
htpasswd -c /etc/apache2/.htpasswd username
ln -s /usr/share/awstats/icon /var/www/jeltsch.org/icon
On some Ubutu installs the log files cannot be accessed and even if you change the permissions to
chomd -R 755 /var/log/apache2
they keep being switched back by the logrotation script. In order to fix that read this post.