Installing AWStats at 1and1 (page 3/4)

An updated manual for the installation of advanced webserver statistics

III. Securing AWStats

3.1 Setting file system permissions

The webserver needs only read-access to your files in order for you to be able to access AWStats from the browser. Limiting your own permissions will keep you from accidentally messing with files. Just remember that with this setup you will have to run perl to execute scripts rather than executing the scripts themselves.

$ find ./awstats -type d -exec chmod 701 '{}' \;
$ find ./awstats -not -type d -exec chmod 404 '{}' \;

Your config files are not directly accessed by the webserver. Thus you can further restrict access to them, so that they can't be read through the browser.

$ chmod 400 awstats/cgi-bin/*.conf

3.2 Protecting the AWStats directory with .htaccess

This one is easy: simply copy the .htaccess file that protects your logs directory to your awstats directory and limit access to the file:

$ cp logs/.htaccess awstats/
$ chmod 404 awstats/.htaccess

IV. Setting up AWStats cron jobs

4.1. cron jobs for few config files

In order automatically update AWStats, you will need to create a cron job. As discussed before, I suggest updating on a daily basis:

$ crontab -e

VIM opens up. Hit "i" and enter the following line:

15 4 * * * perl $HOME/awstats/cgi-bin/awstats.pl -config=yourself -update

This cron job will update AWStats at 4.15am on a daily basis. "-config="yourself"" refers to your config file (for your dog add another cronjob).

Make sure there is a trailing empty line at the end of your crontab file (after your last command-line). Then hit "[Escape]" to leave the editing mode and type ":x" to save the file and close VIM.

4.2. cron job for many config files

If you have many config files, adding lots of cron jobs may not be very comfortable. In that case you might want to make use of "awstats_updateall.pl", a tool that comes with AWStats, by choosing this alternative cron job (without linebreaks):

15 4 * * * perl $HOME/awstats/tools/awstats_updateall.pl now -awstatsprog=$HOME/awstats/cgi-bin/awstats.pl -configdir=$HOME/awstats/cgi-bin/

Using "awstats_updateall.pl" will call "awstats.pl" and run an update for all config-files to be found in the specified directory (awstats/cgi-bin). Since in this case "awstats.pl" is being executed you need to make sure that permissions are set accordingly:

$ chmod 504 awstats/cgi-bin/awstats.pl

This will allow yourself and thus your cronjob to execute "awstats.pl".

first page | previous page | next page | last page