Awstats: Difference between revisions

From Alpine Linux
mNo edit summary
(replace /etc/init.d with rc-service)
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== Set up Awstats on Alpine Linux ==
[https://awstats.sourceforge.net/ AWStats] is a powerful tool which generates server statistics. AWstats works as a CGI or from command line and shows you all possible information your log contains in a graphical way.
 
This document will be a quick c/p guide to setup awstats log analyzer on Alpine linux. What we will install is the following:
 
*Lighttpd
*Awstats


== Installing Lighthttpd and Awstats ==
== Installing Lighthttpd and Awstats ==


'''Installing Lighthttpd'''
{{:Setting Up Lighttpd With FastCGI}}
 
    apk add lighttpd
 
'''Add Backports Repositories'''
 
    cp /etc/apk/repositories /etc/apk/repositories.old
    echo -e "http://build.alpinelinux.org:8009/backports/1.10/" >> /etc/apk/repositories


'''Installing Awstats'''
'''Installing Awstats'''


    apk add awstats -U --allow-untrusted
{{Cmd|apk add awstats -U}}


'''Removing Bakcports Repositories'''
In {{Path|/etc/lighttpd/lighttpd.conf}}:
 
    cp /etc/apk/repositories.old /etc/apk/repositories
    rm /etc/apk/repositories.old
 
== Configuring Lighttpd==
 
'''Edit lighttpd.conf'''
 
  nano /etc/lighttpd/lighttpd.conf
 
Uncomment line:
 
  include "mod_cgi.conf"


{{Cat|/etc/lighttpd/lighttpd.conf|<nowiki>...
Change the base server root folder
Change the base server root folder
 
#server.document-root = var.basedir + "/htdocs"  
  #server.document-root = var.basedir + "/htdocs"  
server.document-root = "/usr/lib/awstats"
  server.document-root = "/usr/lib/awstats"
...
 
</nowiki>}}


== Configuting Awstats ==
== Configuting Awstats ==
Line 46: Line 22:
'''Run awstats_configure.pl'''
'''Run awstats_configure.pl'''


    awstats_configure.pl
{{Cmd|awstats_configure.pl}}


     -----> Running OS detected: Linux, BSD or Unix
     -----> Running OS detected: Linux, BSD or Unix
Line 69: Line 45:


     nano /etc/awstats/awstats.awstats.conf  
     nano /etc/awstats/awstats.awstats.conf  
     Search the line '''LogFile=" "''' and configure your log path and file. e.g.''' LogFile="/va/log/messages"'''
     Search the line '''LogFile=" "''' and configure your log path and file. e.g.''' LogFile="/var/log/messages"'''


'''Start http server and add to boot'''
'''Start http server and add to boot'''


    /etc/init.d/lighttpd start && rc-update add lighttpd default
{{Cmd|rc-service lighttpd start && rc-update add lighttpd default}}


Browse  
Browse  


     http://AWSTATS_IP_NUMBER/cgi-bin/awstats.pl?config=awstats
     <nowiki>http://AWSTATS_IP_NUMBER/cgi-bin/awstats.pl?config=awstats</nowiki>


Note: Awstats is not working yet with dansguardian logs.
Note: Awstats is not working yet with dansguardian logs.


 
[[Category:Monitoring]]
EOF

Latest revision as of 10:22, 17 November 2023

AWStats is a powerful tool which generates server statistics. AWstats works as a CGI or from command line and shows you all possible information your log contains in a graphical way.

Installing Lighthttpd and Awstats

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

# rc-service lighttpd start # rc-update add lighttpd default

Installing Awstats

apk add awstats -U

In /etc/lighttpd/lighttpd.conf:

Contents of /etc/lighttpd/lighttpd.conf

... Change the base server root folder #server.document-root = var.basedir + "/htdocs" server.document-root = "/usr/lib/awstats" ...

Configuting Awstats

Run awstats_configure.pl

awstats_configure.pl

   -----> Running OS detected: Linux, BSD or Unix
   Do you want to continue setup from this NON standard directory [yN] ? y
   
   -----> Check for web server install
   Config file path ('none' to skip web server setup): none
   -----> Need to create a new config file ?  y
   
   -----> Define config file name to create
   Example: www.mysite.com
   Example: demo
   Your web site, virtual server or profile name: awstats
   
   -----> Define config file path
   >/etc/awstats 
   
   Press ENTER to continue...
   Press ENTER to finish...

Edit awstats.awstats.conf

   nano /etc/awstats/awstats.awstats.conf 
   Search the line LogFile=" " and configure your log path and file. e.g. LogFile="/var/log/messages"

Start http server and add to boot

rc-service lighttpd start && rc-update add lighttpd default

Browse

   http://AWSTATS_IP_NUMBER/cgi-bin/awstats.pl?config=awstats

Note: Awstats is not working yet with dansguardian logs.