Nginx Log Analysis AWStats + jawstats installation configuration

Source: Internet
Author: User
Tags config mkdir pack php file nginx server

 awstats is a Perl based WEB log Analytics tool, and Jawstats is a PHP based statistical suite designed to provide a more polished graphical interface for Awstats. Installation and configuration Awstatsawstats installation is simple, but you must first confirm that the PERL environment on your server is ready. Considering the site 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/awstatschown-r root:root/usr/local/awstats2. Build profiles Use the Awstats_configure.pl Wizard tool to generate profiles for each Web site CD/USR/LOCAL/AWSTATS/TOOLS./AWSTATS_CONFIGURE.PL1 Enter none and then return 2 to enter Y Confirm Create configuration file 3 Enter profile name, general input domain name. 4 The profile uses the default path/ETC/AWSTATS5) press ENTER to continue 6) to complete the creation of the configuration file by return 3. Modify configuration file Awstats supports dynamic log files based on date changes, which can be read in the comments. vim/etc/awstats/awstats.wangyan.org.conf logfile= "/usr/local/nginx/logs/wangyan.org/access.log" (51 lines or so) 4. Generate Awstats Statistics # Create a directory for storing data mkdir-p/var/lib/awstats# method One: Generate data for the specified Web site. /usr/local/awstats/wwwroot/cgi-bin/awstats.pl-update-config=wangyan.org #方法二: Generate data for all Web sites/usr/local/awstats/tools/ awstats_updateall.pl now5. Output statistics static page (optional) If on Apache, that can directly open the page to view the statistics, of course, Nginx can also omit this step, because the jawstats has not yet appeared ... Mkdir-p/var/www/awstats/wangyan.org # Create a directory that holds 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 is Chinese-awstatsprog=/usr/local/awstats/ wwwroot/cgi-bin/awstats.pl awstats Log Update path. 6. Configure the Awstats to run automatically, set to update every hour. CRONTAB-E0 * * * * */usr/local/awstats/tools/awstats_updateall.pl now II, installation and configuration Jawstatsjawstats is based on awstats statistics, but its interface is more powerful, With Jawstats, you can even abandon a third party statistic. 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 Profile Official configuration instructions see: Http://www.jawstats.com/documentationjawstats is supported by multiple sites, each $aConfig corresponding to a site, and free to switch. <?php//Core config parameters $sDefaultLanguage = "ZH-CN"; Set the default language $sConfigDefaultView = "Thismonth.all"; $bConfigChangeSites = false; Is it possible to replaceSite $bConfigUpdateSites = false; Whether statistical data can be updated $sUpdateSiteFilename = "xml_update.php"; Individual site Configuration $aConfig ["site1"] = Array (//site1 site domain name (note cannot be filled in) "Statspath" => "/var/lib/awstats/",/ /awstats Statistical Data Directory "Updatepath" => "/usr/local/awstats/wwwroot/cgi-bin/awstats.pl/",//For updating statistics "SiteURL" => "http ://wangyan.org ",///Click on the title of the first page will go to this address" sitename "=>" wangyan.org ",//home title" theme "=>" Default "," Fadespeed "=> 250," Password "=>" "My-1st-password",//update statistic data need to enter this password "includes" => "", "Language" => "ZH-CN");? >2.3. Install Chinese Language pack first download jawstats Multi-Language Pack, unzip and upload the replacement lang directory. Http://www.jawstats.com/src/languagepack.zip need to note is that you want to modify the translations.php file encoding for UTF-8, otherwise all garbled. Another modification of the Chinese file, is also translations.php, can not only modify the Zh-cn.js file. 2.4. Set Jawstats access password Nginx support for the directory to add password authentication, if you do not want everyone to have access to your statistical results, then continue to the following steps ... 1 use Apache htpasswd to create a password file. Syntax: htpasswd-b-c/home/wangyan/.htpasswds username Password 2 Add the following content in the Nginx server field location ~/stats {root/var/www; location ~ P hp$ {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; Finally, the input https://youdomain/stats/can be accessed. References: 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.