07.06.2014 Views

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

2 - Raspberry PI Community Projects

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

information it contains; SiteDomain and HostAliases list the various names under which the<br />

main web site is known.<br />

For high traffic sites, DNSLookup should usually not be set to 1; for smaller sites, such as the<br />

Falcot one described above, this setting allows getting more readable reports that include full<br />

machine names instead of raw IP addresses.<br />

SECURITY<br />

Access to statistics<br />

AWStats makes its statistics available on the website with no restrictions by<br />

default, but restrictions can be set up so that only a few (probably internal)<br />

IP addresses can access them; the list of allowed IP addresses needs to be<br />

defined in the AllowAccessFromWebToFollowingIPAddresses parameter<br />

AWStats will also be enabled for other virtual hosts; each virtual host needs its own configuration<br />

file, such as /etc/awstats/awstats.www.falcot.org.conf.<br />

Include "/etc/awstats/awstats.conf"<br />

SiteDomain="www.falcot.org"<br />

HostAliases="falcot.org"<br />

Example 11.21<br />

AWStats configuration file for a virtual host<br />

This will only work if the /etc/awstats/awstats.conf file does not contain any Include directive,<br />

since AWStats cannot handle multi-level inclusions; unfortunately, the default file provided<br />

by Debian does contain such a directive.<br />

To have this new virtual host taken into account, the /etc/cron.d/awstats needs to be edited<br />

to add an invocation such as the following: /usr/lib/cgi-bin/awstats.pl -config=www.<br />

falcot.org -update<br />

0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc<br />

➥ /awstats/awstats.conf -a -r /var/log/apache2/access.log ] && /usr/lib/<br />

➥ cgi-bin/awstats.pl -config=awstats -update >/dev/null && /usr/lib/cgi-<br />

➥ bin/awstats.pl -config=www.falcot.org -update >/dev/null<br />

Example 11.22<br />

The /etc/cron.d/awstats file<br />

AWStats uses many icons stored in the /usr/share/awstats/icon/ directory. In order for<br />

these icons to be available on the web site, the Apache configuration needs to be adapted to<br />

include the following directive:<br />

Alias /awstats-icon/ /usr/share/awstats/icon/<br />

After a few minutes (and once the script has been run a few times), the results are available<br />

online:<br />

274 The Debian Administrator's Handbook

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!