Debain install awstats



From :

AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.

The following documentation contains specific information on installing and configuring Awstats with Ubuntu and Apache2. It assumes you already have an Apache2 web server up and running. For more help, get XChat and subscribe to channel "#awstats" on the Ubuntu Server.



Install AWStats with Synaptic or

sudo apt-get install awstats



Awstats configuration files in Ubuntu are located in /etc/awstats. The template is called "awstats.conf".

  1. Create a copy of awstats.conf for each domain:

     cp /etc/awstats/awstats.conf /etc/awstats/awstats.yourdomain.ext.conf
  2. modify the file:

    1. Open file with vi or nano:

        vi /etc/awstats/awstats.yourdomain.ext.conf


        nano /etc/awstats/awstats.yourdomain.ext.conf
    2. make the following changes:

        HostAliases="localhost yourdomain.ext"
  3. generate the initial stats for AWStats based on existing var/log/apache2/access.log:

     /usr/lib/cgi-bin/ -config=yourdomain.ext -update


Apache2 Configuration

First tell your apache to use mod_cgi if you haven't enabled it yet

a2enmod cgi

In order to access Awstats, we have to tell Apache2 where it is.

  1. tell Apache where the stats are:

    1. Navigate to /etc/apache2/sites-available/

        cd /etc/apache2/sites-available/
    2. If you have no VirtualHosts set up, place the following code in '/etc/apache2/sites-available/default'. Otherwise, add this code inside the VirtualHost tag for each domain you want to monitor:

        Alias /awstatsclasses "/usr/share/awstats/lib/"
        Alias /awstats-icon "/usr/share/awstats/icon/"
        Alias /awstatscss "/usr/share/doc/awstats/examples/css"
        ScriptAlias /awstats/ /usr/lib/cgi-bin/
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  2. Reload apache2:

     /etc/init.d/apache2 reload

Statistics for yourdomain.ext should now be available at:




for if you have multiple config files. Note that these statistics are public unless you secure them.


Crontab Configuration

Add the following code to /etc/crontab for each domain:


0 */3 * * * /usr/lib/cgi-bin/ -config=yourdomain.ext -update > /dev/null








您的电子邮箱地址不会被公开。 必填项已用 * 标注