How to install and configure Awstats

Source: Internet
Author: User
Tags definition chmod config require install perl

I. Installation of Awstats

1. Preparation before installation

Awstats has a lot of Perl scripts that require Perl support to execute these scripts, so install Perl first

# yum-y Install Perl

2. Start Installation Awstats

The latest version is 7.0

http://sourceforge.net/projects/awstats/files/AWStats/

At the above URL you can find the download address of the file

# tar XF awstats-7.0.tar.gz  
# mv Awstats-7.0/usr/local/awstats 
# cd/usr/local/awstats # 
chmod +x/usr/local /awstats/tools/*.pl 
# chmod +x wwwroot/cgi-bin/*.pl 
# tools/awstats_configure.pl    //Start installation configuration 
default profile in/ etc/awstats/awststs.domain-name.conf 
     
# vim/etc/awstats/awstats.www.domain-name.conf 
need to modify LogFile, The location of your log file 
logfile= "/var/log/nginx/%yyyy-24/%mm-24/access_%yyyy-24%mm-24%dd-24.log"
logformat=1     Log format, this must be to analyze the log format matching, or may not analyze the data or the analysis of the incorrect data 
logseparator= ""    //Specify the log of the split 
sitedomain= " Www.domain-name.com "    ///To analyze the location of the site domain name 
dirdata="/opt/awstats "      //parsed data file

Second, the use of Awstats analysis log

Use the following command to genetic awstats data to provide Web Access.

I am here to analyze the Nginx log, if the old version of the Nginx or nginx format is their own definition, you need to change the Awstats configuration file, in which there is a definition of log format, with its own log format matching. If the log format does not match, then the data will not be parsed. The general new version of the Nginx log format can be used directly.

The following log format can be directly analyzed by awstats7.0

Log_format Main ' $remote _addr-$remote _user [$time _local] ' $request '

' $status $body _bytes_sent ' $http _referer '

' $http _user_agent ', ' $http _x_forwarded_for ';

Use the following command to genetic awstats data to provide Web Access.

#/usr/bin/perl/var/www/html/awstats/wwwroot/cgi-bin/awstats.pl-config=www.domain0name.com-update

If you need to automatically execute the above commands every day, you can join Crontab # crontab-e * */usr/bin/perl/var/www/html/awstats/wwwroot/cgi-bin/awstats.pl-conf Ig=www.domain-name.com-update &>/dev/null

Third, visit

Http://youdomain/awstats/atstats.pl?config=www.domain-name.com

If you use Apache to provide the web, then when you install, one step is to get you to choose your Apache profile location, and Awstats will automatically add the relevant configuration to the Apache configuration file.

If not specified, manually add the following, or add a virtual host yourself

# vim/etc/httpd/conf/httpd.conf    //Add the following configuration 
alias/awstatsclasses "/var/www/html/awstats/wwwroot/classes/"
alias/awstatscss "/var/www/html/awstats/wwwroot/css/"
Alias/awstatsicons "/var/www/html/awstats/wwwroot/icon/"
scriptalias/awstats/"/var/www/html/awstats/wwwroot /cgi-bin/' # ' # is ' to 
permit URLs access to scripts/files in AWStats directory. 
# 
<directory "/var/www/html/awstats/wwwroot" > 
    Options None 
    allowoverride None Order 
    allow , deny 
    Allow from all 
</Directory>

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/zs/

# service HTTPD reload//reload Apache configuration file

If you need to do awstats user Login control, you can use the Apache Basic Authentication Mode # Htpasswd-cm/var/www/html/awstats/htpasswd.user admin input two times password can be

# vim/etc/httpd/conf/httpd.conf    //Add 
The following <files "awstats.pl" > 
authname "Mingdao awstats"
AuthType Basic 
authuserfile/var/www/html/awstats/htpasswd.user 
Require user admin 
</Files>

# service HTTPD Reload//Reload Apache configuration file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.