未分類

FreeBSD6.1 安裝 awstats – 網站資料分析軟體

官方網站:http://awstats.sourceforge.net/


// 到官方網站下載程式
# fetch http://prdownloads.sourceforge.net/awstats/awstats-6.5.tar.gz
// 解壓縮,並且指定解到 /usr/local 目錄
# tar zxvf awstats-6.5.tar.gz -C /usr/local/
# cd /usr/local/awstats-6.5/tools/
// 開始執行設定過程
# perl awstats_configure.pl

/usr/local/awstats-6.5
to standard directory:
/usr/local/awstats
And then, run configure.pl from this location.
Do you want to continue setup from this NON standard directory [yN] ? y
// 安裝到 /usr/local/awstats-6.5 沒問題,所以 y

—–> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:Program filesapache groupapacheconfhttpd.conf
Config file path (‘none’ to skip web server setup):
> /usr/local/etc/apache21/httpd.conf
// 這裡的OS是FreeBSD6.1,所以apache的設定檔位置如上

—–> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y
// 要自動產生設定檔,y

—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> smallken
// 隨便打個名稱給它

—–> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
>
// 設定檔目錄要存在 /etc/awstates 沒問題,所以直接按 Enter 繼續

—–> Create config file ‘/etc/awstats/awstats.smallken.conf’
Config file /etc/awstats/awstats.smallken.conf created.

—–> Don’t forget to restart manually your web server
// 最後它跟我們說已經建立好 /etc/awstats/awstats.smallken.conf 設定檔了,必要時要再手動修改它

—–> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats-6.5/wwwroot/cgi-bin/awstats.pl -update -config=smallken
Or if you have several config files and prefer having only one command:
/usr/local/awstats-6.5/tools/awstats_updateall.pl now

A SIMPLE config file has been created: /etc/awstats/awstats.smallken.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for ‘smallken’ with command:
> perl awstats.pl -update -config=smallken
You can also read your statistics for ‘smallken’ with URL:
> http://localhost/awstats/awstats.pl?config=smallken

Press ENTER to finish…

// 接下來我們要手動去修改 awstats.smallken.conf 這個設定檔
# vi /etc/awstats/awstats.smallken.conf
// FreeBSD6.1預設apache的log檔位置
LogFile=”/var/log/httpd-access.log”
// 針對 www 的登錄檔分析
LogType=W
// 怎麼輸入都可以
SiteDomain=”smallken”
// 設定成中文介面
Lang=”tw”
// 建立程式要用的目錄
# mkdir -p /var/lib/awstats
# cd /usr/local/awstats-6.5/wwwroot/cgi-bin/
# chmod +x ./*.pl

// 修改 httpd.conf
# vi /usr/local/etc/apache21/httpd.conf
// 這行在很後面,之前安裝程式加入的幾行中,修改這一行
Alias /awstats/ “/usr/local/awstats-6.5/wwwroot/cgi-bin/”

// 重新啟動 apache
# /usr/local/etc/rc.d/apache21.sh restart

// 修改權限
# cd /usr/local
# chmod -R 755 awstats-6.5/
# chown -R root:wheel awstats-6.5/

// 產生報表,index.html就是統計報表網頁
# cd /usr/local/awstats-6.5/wwwroot/cgi-bin/
# perl awstats.pl -config=smallken -update -output > index.html

// http://localhost/awstats/,即可看到統計網頁
// 成功之後,我們可以加入 cron
# cd /usr/local/awstats-6.5/wwwroot/cgi-bin/
# vi awstats.sh
// 加入以下內容
#!/bin/sh
cd /usr/local/awstats-6.5/wwwroot/cgi-bin/
perl awstats.pl -config=smallken -update -output > index.html

# vi /etc/crontab
// 加入以下這行,設定每天18:00自動執行統計報表
0 18 * * * root /usr/local/awstats-6.5/wwwroot/cgi-bin/awstats.sh

Linux 安裝可以參考鳥哥的站
http://linux.vbird.org/linux_server/0360apache.php#other_pkg_awstats

One thought on “FreeBSD6.1 安裝 awstats – 網站資料分析軟體

  1. 自動引用通知: SmallKen's Blog » Blog Archive

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *