Configuring AWStats in Ubuntu server

Source: Internet
Author: User

AWStats is an open source web analytics Reporting tool that generates access charts for powerful websites, streaming media, FTP, or mail servers. This Log Parser works on a CGI or command-line basis and displays all of the information in your log as if it were a chart in the Web page. It can "partially" read information files so that a large number of log files can be processed frequently and quickly. It supports the vast majority of Web server log file formats, including Apache,iis.

Installing the AWStats Package

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

You can install by running the following command:

    1. sudo apt-get install awstats

Next, you need to enable the Apache CGI module.

Run the following command to start the CGI:

    1. sudo a2enmod cgi

Now, restart Apache for the change to take effect.

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

Configure AWStats

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

To complete this step, you can configure the domain you want to count by copying the default configuration file for AWStats.

    1. sudo cp/etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf

Now you need to make some changes in the configuration file:

    1. sudo vim /etc/awstats/awstats.test.com.conf

Add directly to the last:

  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 establish preliminary statistics using the server's current log. You can do this:

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

Configure Awstats for Apache to update the log by setting a timer task

It is recommended that you create a timed task that periodically updates the AWStats database with the newly created log entries, and the statistics are updated periodically. This will also save you time.

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

    1. sudonano/etc/crontab

Add the following line to let AWStats update 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 lets you know the status of your website and helps you analyze your website. It is very easy to install and configure. If you have any questions, please leave a comment below.

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

Run the following command to complete this step:

  1. sudo cp-r /usr/lib/cgi-bin /var/www/html/
  2. sudo chown Www-< Span class= "PLN" >data:www-data /var/www/ html/cgi-bin
  3. sudo chmod-R 755 /var/www/html/cgi-bin/

Test AWStats

You can now view the Awstats page by visiting the URL "http://your-server-ip/cgi-bin/awstats.pl?config=test.com."

Its page looks like this:

Configuring AWStats in Ubuntu server

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.