Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx uses AWStats log analysis

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

AWstats introduction

Awstats is a free, very simple and powerful website log analysis tool.

It can count the following information about your site:

Number of visits, number of visits, page views, clicks, data traffic, etc.

Two: accurate to monthly, daily and hourly data

Three: visitor country

Four: visitor IP

Five: statistics of Robots/Spiders

Six: visitor duration

Seven: statistics for different Files type

Eight: statistics of Pages-URL

Nine: guest operating system browser and other information

Ten: other information (search keywords, etc.)

Environment:

Centos7 operating system server IP 192.168.30.31.

The Nginx server that has been deployed is compiled and installed here.

The DNS forward parsing has been done, and the server can be accessed normally through www.aa.com.

Deployment Services:

Verify that the Perl environment is installed on the server before installing AWstats.

1. Extract and install AWstats

[root@lin3031 ~] # tar xf awstats-7.6.tar.gz

[root@lin3031 ~] # mv awstats-7.6 / usr/local/awstats

Modify awstats attribute master group

[root@lin3031 local] # chown root.root-R / usr/local/awstats/

Enter the tools directory

[root@lin3031 local] # cd / usr/local/awstats/tools/

2. Create a new statistical profile for the www.aa.com site, and create it with the help of the awstats_configure.pl script provided by awstats

[root@lin3031 tools] #. / awstats_configure.pl

-AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur-

This tool will help you to configure AWStats to analyze statistics for

One web server. You can try to use it to let it do all that is possible

In AWStats setup, however following the step by step manual setup

Documentation (docs/index.html) is often a better idea. Above all if:

-You are not an administrator user

-You want to analyze downloaded log files without web server

-You want to analyze mail or ftp log files instead of web log files

-You need to analyze load balanced servers log files

-You want to 'understand' all possible ways to use AWStats...

Read the AWStats documentation (docs/index.html).

-> Running OS detected: Linux, BSD or Unix

-> Check for web server install

Enter full config file path of your Web server.

Example: / etc/httpd/httpd.conf

Example: / usr/local/apache2/conf/httpd.conf

Example: C:\ Program files\ apache group\ apache\ conf\ httpd.conf

Config file path ('none' to skip web server setup):

> none # Nginx enter none

Your web server config file (s) could not be found.

You will need to setup your web server manually to declare AWStats

Script as a CGI, if you want to build reports dynamically.

See AWStats setup documentation (file docs/index.html)

-> Update model config file'/ usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'

File awstats.model.conf updated.

-> Need to create a new config file?

Do you want me to build a new AWStats config/profile

File (required if first install) [yplink N]? Y # enter y

-> Define config file name to create

What is the name of your web site or profile analysis?

Example: www.mysite.com

Example: demo

Your web site, virtual server or profile name:

> www.aa.com # enter the domain name to be counted

-> Define config file path

In which directory do you plan to store your config file (s)?

Default: / etc/awstats

Directory path to store config file (s) (Enter for default):

> # keep the default and enter

-> Create config file'/ etc/awstats/awstats.www.aa.com.conf'

Config file / etc/awstats/awstats.www.aa.com.conf created.

-> Add update process inside a scheduler

Sorry, configure.pl does not support automatic add to cron yet.

You can do it manually by adding the following command to your cron:

/ usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update-config=www.aa.com

Or if you have several config files and prefer having only one command:

/ usr/local/awstats/tools/awstats_updateall.pl now

Press ENTER to continue... # enter

A SIMPLE config file has been created: / etc/awstats/awstats.www.aa.com.conf

You should have a look inside to check and change manually main parameters.

You can then manually update your statistics for 'www.aa.com' with command:

> perl awstats.pl-update-config=www.aa.com

You can also build static report pages for 'www.aa.com' with command:

> perl awstats.pl-output=pagetype-config=www.aa.com

Press ENTER to finish... # enter

3. Modify www.aa.com statistics configuration file

[root@lin3031 ~] # vim / etc/awstats/awstats.www.aa.com.conf

Modify nginx log file location

Data directory. Awstats directory does not exist by default and needs to be created.

Create / var/lib/awstats directory

[root@lin3031] # mkdir-p / var/lib/awstats

4. Update the analysis log file

[root@lin3031] # / usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update-config=www.aa.com

5. Generate static analysis log web page data

[root@lin3031] # / usr/local/awstats/tools/awstats_buildstaticpages.pl-update-config=www.aa.com-lang=cn-dir=/usr/local/awstats/wwwroot-awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl

The above order is interpreted as follows:

/ usr/local/awstats/tools/awstats_buildstaticpages.pl: awstats static page generation tool

-update-config=www.test.com: update the configuration domain name

-lang=cn: the language is Chinese

Dir=/usr/local/awstats/wwwroot: the directory where the statistical results are output

Awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl: the path to the log update

Modify nginx's conf file so that its access to www.aa.com and www.aa.com/awstats does not affect each other

O

The effect is as follows

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report