Centos + nginx + AWStats

Source: Internet
Author: User

Wget http://nchc.dl.sourceforge.net/sourceforge/awstats/awstats-6.9.tar.gz
Tar zxvf awstats-6.9.tar.gz
Music awstats-6.9 // usr/local/
CD/usr/local/awstats-6.9/tools/
./Awstats_configure.pl

Do you want to continue setup from this non standard directory [YN]?

Y

Config file path ('none' to skip Web Server SETUP ):

> None

File (required if first install) [Y/n]?

Y

Example: Demo
Your web site, virtual server or profile name:
> Test.openx.cn

-----> 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 ):
> Enter (by default, the configuration file is saved in/etc/AWStats)
 
 
 

Vim/etc/AWStats/awstats.test.openx.cn. conf

Replace the following Configuration:
Logfile = "/home/wwwlogs/Access _ % YYYY-24 % MM-24 % DD-24.log"

3. Start analysis and generate results

Finally, you can perform the analysis.

Run the following command:
/Usr/local/awstats-6.9/tools/wwwroot/cgi-bin/AWStats. pl-Update-Config = test.openx.cn
 

This command generates the result to the awstatsxxxx.www.xxxx.com.txt file in the/var/lib/AWStats directory.

Of course this looks inconvenient. You can use the following command to generate an HTML page, which is more intuitive.

/Usr/local/awstats-6.9/tools/awstats_buildstaticpages.pl-Update-Config = test.openx.cn-lang = cn-Dir =/data/AWStats-awstatsprog =/usr/local/awstats-6.9/wwwroot/cgi -bin/AWStats. PL

/Usr/local/awstats-6.9/tools/awstats_buildstaticpages.pl-update \
-Config = www.xxxxoke.com-lang = cn \
-Dir =/html/AWStats \
-Awstatsprog =/usr/local/awstats-6.9/tools/wwwroot/cgi-bin/AWStats. pl

 

This will generate a very intuitive analysis result page under the/html/AWStats directory.

 

Iv. Automation

It would be annoying to run several commands on the server every day. Thanks to crontab in the Linux World,

The following is a crontab from a netizen.

 

1 0 *** sh/home/ZYF/SH/cut_nginx_log.sh

0 1 ***/usr/local/awstats-6.9/wwwroot/cgi-bin/AWStats. pl-Update-Config = www.xxxxke.com

0 2 ***/usr/local/awstats-6.9/tools/awstats_buildstaticpages.pl-Update-Config = www.xxxxke.com-lang = cn-Dir =/html/AWStats-awstatsprog =/usr/local/ awstats-6.9/tools/wwwroot/cgi-bin/AWStats. PL

Logfile = "/home/wwwlogs/Access _ % YYYY-24 % MM-24 % DD-24.log"

log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"'
'$ Status $ body_bytes_sent "$ http_referer"'
'"$ http_user_agent "" $ http_x_forwarded_for "';

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.