centOS 7 apache log 通過 AWStats 訪問

awstats 可以通過apache 部署,關聯指定格式的日志文件(apache,nginx),然后通過網頁的形式展現出來,便于觀察分析。


awstats的安裝

1 加壓 拷貝 創建需要的文件

# tar xf awstats-7.6.tar.gz ? 解壓下載到/root下的壓縮包 ? ?

# mkdir /usr/local/awstats ?

# mkdir /var/lib/awstats ?

# chmod 755 /usr/local/awstats ?

#cp -R awstats-6.5/ /usr/local/awstats ? ??

# cd /usr/local/awstats/ ? ? ?進入到解壓目錄下 ? ?

# ls ? ? ?

docs ?README.TXT ?tools ?wwwroot ? ?

# cd tools/ ? ?

# ls ? ?

# perl awstats_configure.pl ??

1 Config file path ('none' to skip web server setup):

> none ? ? ?默認填寫none就OK


2 ?Do you want me to build a new AWStats config/profile

file (required if first install) [y/N] ? y ? ?默認yes就OK


3 Your web site, virtual server or profile name:

> www.a10.com ? ? ? ? ? ? ? ? 上面介紹過通過www.a10.com來訪問 并進行日志分析


4 Default: /etc/awstats ? ? ? ? ? 默認的配置文件存放位置

Directory path to store config file(s) (Enter for default):

> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?敲enter鍵默認即可

? ? OK 交互界面結束

2 ?配置awstats的配置文件

# cd /etc/awstats ?

# vim awstats.www.linuxidc.com.conf ? ??

? //修改一下幾項即可 其它都可以默認 ?

LogFile="/var/log/httpd/access_log"?

DirData="/var/lib/awstats"?

DirCgi="/awstats"?

DirIcons="/awstatsicons"?

//執行下面的命令?

# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.a10.com ?


4 ?配置web的配置文件

# vim /etc/httpd/conf/httpd.conf

? //在行尾添加如下內容

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/" ?

Alias /awstatscss "/usr/local/awstats/wwwroot/css/" ?

Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/" ?

ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/" ?

# ?

# This is to permit URL access to scripts/files in AWStats directory. ?

# ?

<Directory "/usr/local/awstats/wwwroot">?

? ? Options None ?

? ? AllowOverride None ?

? ? # todo Allow open access:

? ? Require all granted ?

</Directory>?

5 重啟服務

#service httpd restart?

瀏覽器中輸入http://www.a10.com/awstats/awstats.pl?config=www.a10.com 即可

看到如下圖的日志分析頁面



參考鏈接:

稍有修改——http://www.linuxidc.com/Linux/2012-08/68004.htm

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容