How to configure AWStats in Ubuntu Server

Source: Internet
Author: User
Tags apache log file apache log
AWStats is an open-source website analysis report tool that can generate powerful access statistics for websites, streaming media, FTP, or email servers. This log analyzer works in CGI or command line mode, and displays all the information in the form of charts on the web page as much as possible. It can read information files in & ldquo; and some & rdquo;, so that a large number of log files can be processed frequently and quickly. It supports most Web server log files, including Apache and IIS. This article will help you

AWStats is an open-source website analysis report tool that can generate powerful access statistics for websites, streaming media, FTP, or email servers. This log analyzer works in CGI or command line mode, and displays all the information in the form of charts on the web page as much as possible. It can read information files in part, so that a large number of log files can be processed frequently and quickly. It supports most Web server log files, including Apache and IIS.

This article will help you install and configure AWStats on Ubuntu.

 

Install the AWStats package

By default, the AWStats package can be found in the Ubuntu repository.

You can install it by running the following command:

  1. sudoapt-get install awstats

Next, you need to enable the CGI Module of Apache.

Run the following command to start CGI:

  1. sudo a2enmod cgi

Restart Apache to make the change take effect.

  1. sudo/etc/init.d/apache2 restart

 

Configure AWStats

You need to create a configuration file for each domain or website where you want to view statistics. In this example, we will create a configuration file for "test.com.

To complete this step, you can copy the default configuration file of AWStats to configure the domain for statistics.

  1. sudocp/etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf

Now, you need to make some modifications in the configuration file:

  1. sudonano/etc/awstats/awstats.test.com.conf

Modify it as follows:

  1. #Change to Apache log file, by default it's /var/log/apache2/access.log
  2. LogFile="/var/log/apache2/access.log"
  3. # Change to the website domain name
  4. SiteDomain="test.com"
  5. HostAliases="www.test.com localhost 127.0.0.1"
  6. # When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser
  7. AllowToUpdateStatsFromBrowser=1

Save and close the file.

After modifying the configuration file, you need to use the current log of the server to create a preliminary statistics. You can do this:

  1. sudo/usr/lib/cgi-bin/awstats.pl -config=test.com -update

The output will look like this:

Awtstats

 

Configure AWStats for Apache

Next, you need to configure Apache2 to display statistics. Now you need to copy the content in the "cgi-bin" folder to the default Apache root directory. By default, it is in "/usr/lib/cgi-bin ".

Run the following command to complete this step:

  1. sudocp-r /usr/lib/cgi-bin /var/www/html/
  2. sudochown www-data:www-data /var/www/html/cgi-bin/
  3. sudochmod-R 755/var/www/html/cgi-bin/

 

Test AWStats

Now, you can access the url "http: // your-server-ip/cgi-bin/awstats. pl? Config = test.com. "To view the AWStats page.

Its page is like the following:

Awstats_page

 

Set a scheduled task to update logs

We recommend that you create a scheduled task and use the newly created log entries to regularly update the AWStats database, and then the statistics are regularly updated. This will save you time.

To do this, you need to edit the "/etc/crontab" file:

  1. sudonano/etc/crontab

Add the following line to update AWStats every 10 minutes.

  1. */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update

Save and close the file.

 

Conclusion

AWStats is a very useful tool that allows you to know the status of your website and help you analyze your website. It is easy to install and configure. If you have any questions, please comment below.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Via: https://www.maketecheasier.com/set-up-awstats-ubuntu/

Author: Hitesh Jethva Translator: strugglingyouth Proofreader: wxy

This article was originally compiled by LCTT and launched with the honor of Linux in China

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-12/125799.htm

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.