awstats install for apache

  • 来源:
  • 更新日期:2018-05-02

摘要:系统环境 centos6.4 (最小化安装) apr-1.4.5.tar.gz arp-util-1.3.12.tar.gz awstats-7.3.tar.gz httpd-2.4.9.tar.gz pcre-8.10.tar.gz       1. #yum -y install gcc #yum -y install gcc-c++ #yum -y install

系统环境

centos6.4 (最小化安装)

apr-1.4.5.tar.gz

arp-util-1.3.12.tar.gz

awstats-7.3.tar.gz

httpd-2.4.9.tar.gz

pcre-8.10.tar.gz

 

 

 

1.

#yum -y install gcc

#yum -y install gcc-c++

#yum -y install make

20140308164024_2956.jpg

 

 

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>