Debain install awstats

2017年9月21日

Introduction

From http://awstats.sourceforge.net/ :

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.

 

Installation

Install AWStats with Synaptic or

sudo apt-get install awstats

 

Configuration

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

      or

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

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

     /usr/lib/cgi-bin/awstats.pl -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:

http://yourdomain.ext/awstats/awstats.pl

and:

http://yourdomain.ext/awstats/awstats.pl?config=yourdomain.ext

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/awstats.pl -config=yourdomain.ext -update > /dev/null

 

Links

 

 

参考文章:

https://maoxian.de/2012/11/642.html
http://www.linuxidc.com/Linux/2014-01/94781p4.htm

https://www.xitongjiaocheng.com/ubuntu/2017/59151.html
https://help.ubuntu.com/community/AWStats

没有评论

发表回复

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