2
---
# yum install php-gd
# yum install awstats
1. Edit # vi /etc/awstats/awstats . ”name of your server”.conf
# line 50: change LogFile="/usr/share/awstats/tools/maillogconvert.pl standard < /var/log/maillog | " # line 62: change LogType=M # line 122: comment out and add like follows # LogFormat=1 LogFormat="%time2 %email %email_r %host %host_r %method %url %code %bytesd" # line 848: change like follows LevelForBrowsersDetection=0 LevelForOSDetection=0 LevelForRefererAnalyze=0 LevelForRobotsDetection=0 LevelForSearchEnginesDetection=0 LevelForKeywordsDetection=0 LevelForFileTypesDetection=0 LevelForWormsDetection=0 # line 966: change like follows ShowMonthStats=UHB ShowDaysOfMonthStats=HB ShowDaysOfWeekStats=HB ShowHoursStats=HB ShowDomainsStats=0 ShowHostsStats=HBL ShowRobotsStats=0 ShowEMailSenders=HBML ShowEMailReceivers=HBML ShowSessionsStats=0 ShowPagesStats=0 ShowFileTypesStats=0 ShowOSStats=0 ShowBrowsersStats=0 ShowOriginStats=0 ShowKeyphrasesStats=0 ShowKeywordsStats=0 ShowMiscStats=0 ShowHTTPErrorsStats=0 ShowSMTPErrorsStats=1
2. Now we need to make sure we grant access to web pages. Below is sample of configuration for 192.168.0/24 subnet
# vi /etc/httpd/conf.d/awstats.conf
Alias /awstats/icon/ /var/www/awstats/icon/ ScriptAlias /awstats/ /var/www/awstats/ <Directory /var/www/awstats/> DirectoryIndex awstats.pl Options ExecCGI order deny,allow allow from all </Directory> Alias /awstatsclasses "/var/www/awstats/lib/" Alias /awstats-icon/ "/var/www/awstats/icon/" Alias /awstatscss "/var/www/awstats/examples/css"
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/" Alias /awstatscss "/usr/share/awstats/wwwroot/css/" Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/" ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/" # # This is to permit URL access to scripts/files in AWStats directory. # Options None AllowOverride None # Apache 2.4 Require ip 192.168.0.0/24 # Apache 2.2 Order allow,deny Allow from 192.168.0.0/24 Allow from ::1 # Additional Perl modules SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
3. At this point we will need to restart httpd service to apply new configuration
4. And finally generate reports
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config="name of your server" -update # for example if server name is host1.local /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=host1.local -update
. Now you can access stats
http://host1.local/awstats/awstats.pl
6. Its also a good idea to setup cron job to refresh output. This is example of running it every hour.
#crontab -e 0 * * * */usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=host1.local -update
----