系统环境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>