系統環境css
centos6.4 (最小化安裝)c++
apr-1.4.5.tar.gzweb
arp-util-1.3.12.tar.gz數據庫
awstats-7.3.tar.gzapache
httpd-2.4.9.tar.gzcentos
pcre-8.10.tar.gzdom
1.ide
#yum -y install gccui
#yum -y install gcc-c++orm
#yum -y install make
2.安裝apache
#tar xvf apr-1.4.5.tar.gz
#cd apr-1.4.5
#./configure --prefix=/usr/local/apr
#make
#make install
#tar xvf apr-util-1.3.12.tar.gz
#cd apr-util-1.3.12
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
#make
#make install
#tar xvf pcre-8.10.tar.gz
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install
#tar xvf httpd-2.4.9.tar.gz
#cd httpd-2.4.9
#./configure \
--enable-so \
--enable-mods-shared=all \
--enable-threads \
--enable-cache \
--enable-mem-cache \
--enable-disk-cache \
--enable-file-cache \
--with-mpm=prefork \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--with-pcre=/usr/local/pcre/ \
#make
#make install
添加開機啓動
# echo 「/usr/local/apache2/bin/apachectl start」 >> /etc/rc.d/rc.local
3.安裝awstats
#yum -y install perl
#tar xvf awstats-7.3.tar.gz
#mv awstats-7.3 /usr/local/awstats //awstats默認路徑
#cd /usr/local/awstats/tools
#perl awstats_configure.pl
4.修改apache 虛擬主機設置
#vi /usr/local/apache2/conf/httpd.conf
取消掉如下注釋
#Include conf/extra/httpd-vhosts.conf
註釋掉如下
LogFormat "%h %l %u %t \"%r\" %>s %b" common
虛擬機文件配置以下
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache2/htdocs"
ServerName log.test.com
ServerAlias log.test.com
ErrorLog "logs/test-error_log"
CustomLog "logs/test-access_log" combined
</VirtualHost>
5.修改/etc/awstat配置文件
#vi awstats.log.test.com.conf
LogFile
LogType
LogFormat
DirData="/var/lib/awstats"
DirData修改成本身想要的目錄
DirData="/etc/awstats/data"
#mkdir /etc/awstats/data
#chmod 777 /etc/awstats/data
6.更新數據庫
#perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=log.test.com -update
7.配置完awstats 修改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 All
AllowOverride None
Order allow,deny
Allow from all
Require all granted //添加這一項 不然提示403錯誤
</Directory>
訪問awstats
http://<server name>.<domain>/awstats/awstats.pl?config=<server name>.<domain>