OS:CentOS 5.5
Requirment:
httpd
php php-mysql php-devel
mysql mysql-server
awstats
jawstats
1. 安裝相依套件
yum install httpd php php-devel php-mysql mysql mysql-server
2. 設定Apache,並開機啟動
vi /etc/httpd/conf/httpd.conf
ServerTokens Prod
KeepAlive On
MaxKeepAliveRequests 500
<Directory "/var/www/html">
Options FollowSymLinks
</Directory>
AddHandler cgi-script .cgi .pl
/etc/init.d/httpd restart; chkconfig httpd on
3. 設定MySQL,並開機啟動
/etc/init.d/mysqld restart
mysqladmin -u root password '管理者密碼'
chkconfig mysqld on
4. 下載Awstats程式,並安裝
wget http://prdownloads.sourceforge.net/awstats/awstats-7.0-1.noarch.rpm
rpm -qpR awstats-7.0-1.noarch.rpm
rpm -ivh awstats-7.0-1.noarch.rpm
5. 配置Awstats
cp /usr/local/awstats/tools/httpd_conf /etc/httpd/conf.d/awstats.conf
cd /etc/awstats/
cp awstats.model.conf awstats.localhost.conf
vi /etc/awstats/awstats.localhost.conf
LogFile="/var/log/httpd/access_log"
LogType=W
LogFormat=1
SiteDomain="localhost"
HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
Lang="tw"
6. 執行Awstats網站分析
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=localhost
7. 測試,排成自動分析
開啟瀏覽器 http://your web server/awstats/awstats.pl?config=localhost
crontab -e
0 3 * * * /usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=localhost -update
8. 安裝JAWStats
cd ~
wget http://static.jawstats.com/src/archive/jawstats-0.6beta.tar.gz
mkdir /var/www/html/jawstats
tar -zxvf jawstats-0.6beta.tar.gz -C /var/www/html/jawstats
9. 配置JAWStats
cd /var/www/html/jawstats
cp config.dist.php config.php
vi config.php
<?php
// core config parameters
$sDefaultLanguage = "zh-tw";
...
// individual site configuration
$aConfig["localhost"] = array(
"statspath" => "/usr/local/awstats/wwwroot/cgi-bin/",
"siteurl" => "http://localhost",
"sitename" => "localhost"
"language" => "zh-tw"
);
...
?>
10. 測試
開啟瀏覽器 http://your web server/jawstats
參考文章:
http://linux.vbird.org/linux_server/0360apache.php
http://awstats.sourceforge.net/
http://www.jawstats.com/
http://ssorc.tw/rewrite.php/read-1110.html
http://www.jefflei.com/post/906.html
沒有留言:
張貼留言