Nginx log analysis AWStats + jawstats installation Configuration

Source: Internet
Author: User
Tags nginx server

AWStats is a Perl-based web log analysis tool, while jawstats is a PHP-based statistical suite designed to provide a more elegant graphic interface for AWStats. 1. installing and configuring awstatsawstats is simple, but you must first confirm that the Perl environment on your server is ready. Considering that the website traffic is not large, the daily nginx log cutting can also be omitted... 1. Download and install wget http://prdownloads.sourceforge.net/awstats/awstats-7.0.tar.gztar-zxf awstats-7.0.tar.gzmv
Awstats-7.0/usr/local/awstatschwn-r root: Root/usr/local/awstats2. generate the configuration file using the awstats_configure.pl wizard tool, generate the configuration file CD/usr/local/AWStats/tools for each website. /awstats_configure.pl1) Enter none and press Enter. 2) Enter y to create the configuration file. 3) enter the name of the configuration file. Generally, enter the domain name. 4) use the default path/etc/awstats5 in the configuration file. Press enter to continue. 6) Press enter to create the configuration file. 3.
You can modify the configuration file AWStats to support dynamic log files based on date changes. For more information, see annotations. Vim/etc/AWStats/awstats.wangyan.org. conf logfile = "/usr/local/nginx/logs/wangyan.org/access.log" (about 51 lines) 4. generate AWStats statistics # create the directory where data is stored mkdir-P/var/lib/AWStats # Method 1: generate data for the specified website. /Usr/local/AWStats/wwwroot/cgi-bin/AWStats. pl
-Update-Config = wangyan.org # Method 2: generate data for all websites/usr/local/AWStats/tools/awstats_updateall.pl now5. output statistic result Static Page (optional) if it is on Apache, then you can directly open the web page to view statistics. Of course, nginx can also skip this step, because jawstats has not yet appeared... Mkdir-P/var/www/AWStats/wangyan.org # create a directory for storing results/usr/local/AWStats/tools/awstats_buildstaticpages.pl
-Update-Config = wangyan.org-lang = cn-Dir =/root/tmp-awstatsprog =/usr/local/AWStats/wwwroot/cgi-bin/AWStats. PL/usr/local/AWStats/tools/awstats_buildstaticpages.pl AWStats static page generation tool-Update-Config = wangyan.org Update Configuration item-lang = cn language for Chinese-awstatsprog =/usr/local/AWStats /wwwroot/cgi-bin/AWStats. PL
AWStats log update Program Path. 6. Configure AWStats to run automatically and set it to be updated every hour. Crontab-E0 *****/usr/local/AWStats/tools/awstats_updateall.pl now 2. install and configure jawstatsjawstats Based on AWStats statistics, but its interface is more powerful, with jawstats, you can even discard third-party statistics. 2.1. Download and install wget http://static.jawstats.com/src/jawstats-0.7beta.tar.gzmkdir
/Var/www/stats/tar-zxf jawstats-0.7beta.tar.gz-C/var/www/stats/CD/var/www/stats/CP config. dist. PHP config. php2.2. modify the configuration file official configuration instructions see: http://www.jawstats.com/documentationjawstats is support multi site, each $ aconfig corresponds to a site, and can switch freely. <? PHP // core config parameters $ sdefaultlanguage
= "ZH-CN"; // set the default language $ sconfigdefaview view = "thismonth. all "; $ bconfigchangesites = false; // whether the site can be changed $ bconfigupdatesites = false; // whether statistics can be updated $ supdatesitefilename =" xml_update.php "; // individual site configuration $ aconfig ["Site1"] = array (// Site1 website domain name (note that it cannot be entered incorrectly)
"Statspath" => "/var/lib/AWStats /", // AWStats statistics directory "updatepath" => "/usr/local/AWStats/wwwroot/cgi-bin/AWStats. PL/", // used to update statistics" siteurl "=>" http://wangyan.org ", // click the home page title to go to this address" sitename "=>" wangyan.org ", // homepage title "theme" => "default", "fadespeed" => 250,
"Password" => "my-1st-password", // you need to enter this password to update statistics "des" => "", "language" => "ZH-CN");?> 2.3. to install the Chinese Language Pack, first download the jawstats multi-country Language Pack, decompress the package, and upload and replace the Lang directory. Http://www.jawstats.com/src/?agepack.zip?about is, you need to modify the code of the translations. php file to UTF-8, otherwise it will be all garbled. Also modify the Chinese file, is also translations. php, not just modify the zh-cn.js file. 2.4.
Set the jawstats access password. nginx supports adding password authentication to the directory. If you do not want everyone to access your statistics, proceed to the following steps... 1) Use Apache's htpasswd to create a password file. Syntax: htpasswd-B-c/home/wangyan/. htpasswds username and password 2) Add the following content in the nginx Server field location ~ /Stats {root/var/WWW; location ~ \. Php $ {fastcgi_pass 127.0.0.1: 9000; fastcgi_index
Index. PHP; fastcgi_param script_filename $ document_root/$ fastcgi_script_name; Include fastcgi_params;} auth_basic "jawstats"; auth_basic_user_file/home/wangyan /. htpasswds;} the final result is that you can access it by entering https: // youdomain/stats. Reference: 1. http://www.ibm.com/developerworks/cn/linux/l-cn-awstats-nginx/

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.