Installing AWStats at 1and1 (page 2/4)

An updated manual for the installation of advanced webserver statistics

II. Configuring AWStats

2.1. Creating config files

AWStats uses a configuration file in text format and allows you to analyze any number of subdomains/subdirectories in a given hosting account. For example: In you create a webpage for yourself ( and one for your dog ( You can then configure AWStats to analyze your domain in total or both of your websites (yourself and yourdog) independently. In the latter case you need to create a config-file for each of your web directories (one for and one for

The config files are placed in awstats/cgi-bin/. AWStats comes with a template (awstats.model.conf) which you can copy for each of your subdomains/subdirectories and which you have to edit according to your settings and needs. Rename the middle part of your config files according to your subdomains/subdirectories, e.g. awstats.yourself.conf and awstats.yourdog.conf:

$ cp awstats/cgi-bin/awstats.model.conf awstats/cgi-bin/awstats.yourself.conf

2.2 Editing config files

This tutorial will only cover modifications to the config file that are either essential or of general interest, according to the author's opinion. There are many more options not mentioned here which allow you to further customize AWStats. In any case try to understand the modifications rather than just copying and pasting them.

Unless you edit the config files locally with a texteditor (to upload the files by FTP) use VIM on the 1and1 server:

$ vim awstats/cgi-bin/awstats.yourself.conf

Enter "i" to get into editing mode, use the cursor keys to navigate and make the necessary modifications. Then hit "[Escape]" and type ":x" to save the file and close VIM (use ":q!" if you do not intend to save your changes).

The following modifications to the config file need to be done to analyze the 1and1 webserver logfiles:


Needs to be changed to the location of the 1and1 logfile. The 1and1 webserver creates a new logfile each day. Logfiles before the current one are gzipped. At the end of the week the daily logfiles are merged into a weekly logfile. I suggest updating AWStats once a day, based on the respective zipped logfile created the day before. This will generate less server load than updating more frequently (e.g. on an hourly basis) and no information will be missed around the server's daily change of logfiles.

The location of the logfile as given to AWStats is defined as the piped output of gunzip, which is ordered to unpack the most recent zipped logfile found in the log-directory.

LogFile="gunzip -c $(ls -t $HOME/logs/access*.gz | head -1) |"


Needs to reflect the log format of the 1and1 webserver. You can look at a logfile in a texteditor to find the following scheme (ignore linebreaks):

LogFormat=%host %other %logname %time1 %methodurl %code %bytesd %virtualname %refererquot %uaquot %otherquot


Enter the main address of the domain/subdomain you want to analyze by this config file. Alternative addresses of your domain can be added under HostAliases (see below).


HostAliases="localhost REGEX[myserver\.com$]"

Add any additional adresses, by which your domain/subdomain can be accessed. You can use regular expressions if you like.



AWStats can be accessed from the command line to generate static (x)html-reports. Links within these static reports will have their URLs based on the relative or absolute online location of your cgi-bin directory as provided with this setting.



As well as DirCGI this setting will only be used when generating static (x)html-reports. Name the online location of the icon directory (which contains image and icon files to be used in the reports).



Unauthorized people should not have access to your webserver statistics. The .htaccess file which is necessary to enforce this will be dealt with later (see 3.2).



Enter your FTP user-name here and follow the instructions under 3.2. This will provide access only to that specific user-account.



If several of your websites share a domain ( vs. rather than being organised by subdomains use this filter to analyse them individually. To see your own website's statistics only rather than analysing your dog's hits, too, an adequate regular expression for your config-file would be:


Optional changes you may consider:


Considering the traffic of your website, server load and update speed you might want to fully enable DNS Lookup:



If you don't want AWStats' history files to be saved in the cgi-bin directory, you can choose another location. Notice however, that due to a bug in AWStats, you should avoid using relative paths here:



If the directory configured in DirData does not exist, AWStats will fail, unless you allow for the automatic creation of the directory.



If you wish to be able to manually update AWStats from your browser, you need to change this config and you will not be able to use the $HOME variable in the config file as demonstrated in this tutorial but need to write out the path instead.



Change this option, if you want to be able see statistics for the complete year rather than only for single months while using the browser interface.



If your dog is a German shepherd, you might consider surprising him with a German AWStats interface when looking at his statistics:


first page | previous page | next page | last page