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:
sudoapt-get install awstats
Next, you need to enable the CGI Module of Apache.
Run the following command to start CGI:
sudo a2enmod cgi
Restart Apache to make the change take effect.
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.
sudocp/etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf
Now, you need to make some modifications in the configuration file:
sudonano/etc/awstats/awstats.test.com.conf
Modify it as follows:
#Change to Apache log file, by default it's /var/log/apache2/access.log
LogFile="/var/log/apache2/access.log"
# Change to the website domain name
SiteDomain="test.com"
HostAliases="www.test.com localhost 127.0.0.1"
# When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser
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:
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:
sudocp-r /usr/lib/cgi-bin /var/www/html/
sudochown www-data:www-data /var/www/html/cgi-bin/
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:
sudonano/etc/crontab
Add the following line to update AWStats every 10 minutes.
*/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