Nginx installation awstats analysis of Nginx logs

Source: Internet
Author: User
Tags chmod mkdir

AWStats is a free and powerful log analysis and statistics tool. Therefore, install and record Nginx logs.

The code is as follows: Copy code

 
# Download awstats and modified configuration files
Http://dl.dropboxusercontent.com/u/809946/soft/awstats-7.2.tar.gz wget-c
Http://dl.dropboxusercontent.com/u/809946/conf/awstats.imcat.in.conf wget-c
Tar-zxvf awstats-7.2.tar.gz
Music awstats-7.2/usr/local/awstats
Chown-R root: root/usr/local/awstats
Chmod-R = rwX/usr/local/awstats
Chmod + x/usr/local/awstats/tools/*. pl
Chmod + x/usr/local/awstats/wwwroot/cgi-bin/*. pl
Mkdir-p/etc/awstats/
# Change imcat. in to your domain name. The Log address is your website log address.
Cp awstats. imcat. in. conf/etc/awstats. imcat. in. conf
# Create a database
Mkdir-p/var/lib/awstats
/Usr/local/awstats/wwwroot/cgi-bin/awstats. pl-update-config = imcat. in
# Create a directory for generating static files
Mkdir-p/www/imcat. in/awstats
# Generate static files to the site directory
/Usr/local/awstats/tools/awstats_buildstaticpages.pl-update-config = imcat. in-lang = cn-dir =/www/imcat. in/awstats

Change Nginx configuration
Default

The code is as follows: Copy code

 
Server {
Listen 80;
Server_name imcat. in;
Root/www/imcat. in;
Index index.html;
# Add the following Icon directory
Location ~ ^/Icon/{# icon Directory
Root/usr/local/awstats/wwwroot;
Index index.html;
Access_log off;
    }
}

Finally, use the crontab-e command to add a scheduled task to update data every morning.

The code is as follows: Copy code

Shell

Crontab-e 00 04 ****/usr/local/awstats/tools/awstats_buildstaticpages.pl-update-config = imcat. in-lang = cn-dir =/www/imcat. in/awstats

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.