Install Awstats under Windows to analyze Apache access logs

Source: Internet
Author: User

One, a lengthy two sentences

Before windows with Apache, also once configured Awstats, and then changed the work, switch to Linux+nginx, gradually forget Apache. Also changed the work, and have to use Apache, this version of the update to 2.4, the configuration is slightly different, the other articles are listed again. Website on the line for several months, because there has been no traffic and busy with all kinds of trivial work, has not been to Apache plus awstats for log analysis. The recent site a few activities, understand the slow access, and realized that the addition of log analysis tools. Today, while the weekend, re-configure Awstats, feeling a little strange. Looked up all kinds of information, start again.

Second, the information download

Awstats is written in Perl, so you need to install ActivePerl (http://www.activestate.com/).

Awstats is: official website (http://awstats.sourceforge.net/).

Jawstats, this is auxiliary, I do not use it for the time being. http://www.jawstats.com/.

Apache, don't say it.

III. installation of Apache

The Apache already exists, so this document is ignored.

Iv. download and installation of Perl

I downloaded to the MSI file, the installation of no technical content, the next step is good, in addition to the installation to a specific directory. I installed here: D:\server\Perl64.

V. Download and installation of Awstats

Awstats download is a zip file, directly extracted to a specific directory, such as: D:\server\awstats-7.5.

Vi.. Configuration

Because of my own configuration process, forget, so borrowing reference information, the process is the same.

1. Open the D:\server\awstats-7.5\tools folder, double-click Execute awstats_configure.pl, follow the prompts to enter your Apache installation environment and httpd.conf file location, The following is my native environment:

The direct input "n" here, we manually to configure it, and then two times the return on it.

In this case, the following configuration information is automatically added to the httpd.conf file:

##Directives to allow use of AWStats as a CGI#Alias/awstatsclasses"d:/site/awstats-7.0/wwwroot/classes/"Alias/awstatscss"d:/site/awstats-7.0/wwwroot/css/"Alias/awstatsicons"d:/site/awstats-7.0/wwwroot/icon/"Scriptalias/awstats/"d:/site/awstats-7.0/wwwroot/cgi-bin/"# # This are to permit URLs access to Scripts/filesinchAWStats directory.#<directory"D:/site/awstats-7.0/wwwroot">Options noneallowoverride noneorder allow,denyallow from all</Directory>

In fact, adding to the specific virtual host configuration is also OK.

2.

Modify the Perl path in the awstats.pl file, open the D:\site\awstats-7.0\wwwroot\cgi-bin\awstats.pl file with Notepad, and change the first line #!/usr/bin/perl to

#!d:/perl/bin/perl.exe

There is no way to do this without modification.

Add a new site www.haohtml.com configuration file, copy the awstats.model.conf file (D:\site\awstats-7.0\wwwroot\cgi-bin), Change the name to awstats.www.haohtml.com.conf and modify the Logfile,sitedomain,logtype three instructions in the configuration file . The Web log is analyzed here, so modify the Logtype=w, Change the default language to Chinese, modify the language one,lang= "Auto", "Auto" to "cn", let Awstats work in Chinese mode.

Logtype=w
Logfile= "D:/apache2.2/logs/www/access_%yyyy_%mm_%dd.log"
Sitedomain= "Www.haohtml.com"

Here must pay attention to the format of the log, to ensure that the virtual host www.haohtml.com log file name format and the format of the same can be.

In addition, by default, the log analysis information is not allowed to be updated directly via the Web page, where the value of Allowtoupdatestatsfrombrowser is changed to 1

Allowtoupdatestatsfrombrowser=1

The default configuration for Customlog is common, instead of combined, which is the awstats recommended way to analyze the type of client browser and access the source. For example:

Customlog "|bin/rotatelogs.exe d:/apache2.2/logs/www/access_%y_%m_%d.log 86400 480" combined

This log configuration allows Apache to generate a new log file every day, where%y%m%d is the day of the month. Generally modified files are httpd.conf and extra/httpd-vhosts.conf two files.

Restart Apache, enter http://localhost/awstats/awstats.pl?config=www.haohtml.com, you can see the website log viewing interface.

If there is a new site to add, just follow the above actions to copy one again, modify the relevant configuration information. Here is another way to manage the management, using the configuration file contains the features, so we can configure a common configuration, For example: awstats.common.conf

The configuration of the other sites is then set to: You can override the default inconsistent configuration with the following options.

Awstats.bbs.haohtml.com.conf
Include "Awstats.common.conf"
Logfile= "D:/apache2.2/logs/bbs/access_%yyyy_%mm_%dd.log"
Sitedomain= "Bbs.haohtml.com"

Awstats.www.haohtml.com.conf
Include "Awstats.common.conf"
Logfile= "D:/apache2.2/logs/www/access_%yyyy_%mm_%dd.log"
Sitedomain= "Www.haohtml.com"

3. Security

In order to be safe, the general manager is not allowed to look at this information outside casually, here we need to make a security setting.

Awstats itself does not have any restrictions on access, so we have to implement it through the Apache mechanism, and add the following configuration at the end of httpd.conf:

<Location/awstats/awstats.pl>
Order Deny,allow
AuthType Basic
AuthName "Restricted Files"
AuthUserFile conf/awstats_passwd
Require user Awstats_admin
</Location>

Use Apache's own tool htpasswd to generate a username and password

{apache}/bin/htpasswd-c {apache}/conf/awstats_passwd awstats_admin

Re-enter the password two times.

Restart Apache so that each subsequent access to the Awstats page requires the correct user name (awstats_admin) and password to be entered.

In general, after the configuration is complete, we need to update the log and execute it at the command line.

Awstats.pl-config=www.haohtml.com-update

or open the Http://www.hatml.com/awstats/awstats.pl?config=www.haohtml.com update log via the browser (allowtoupdatestatsfrombrowser= 1).

4.

Let's set up the system to update the log automatically at a specified point in time, so we don't have to manually update the log. Under Linux or UNIX, we are generally using crontab to implement this function only with a scheduled task.

Create a batch file Awstatsupate.bat with the following content:

D:\site\awstats-7.0\wwwroot\cgi-bin\ awstats.pl-update-config=www.haohtml.com
D:\site\awstats-7.0\wwwroot\cgi-bin\ awstats.pl-update-config=bbs.haohtml.com
......

We specify 23:55 points per night to execute this bat file in the scheduled task.

In this way, awstats can be used, of course, awstats may achieve a lot of rich features, want to more flexible configuration, look more help files, very detailed.

Resources:

Windows configuration Awstats is not much information, I really do not know how I came up a few years ago ah.

Reference one: http://www.360doc.com/content/11/0330/10/4062954_105804773.shtml

Install Awstats under Windows to analyze Apache access logs

Related Article

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.