Reference blog:
http://freeloda.blog.51cto.com/2033581/1346412
http://freeloda.blog.51cto.com/2033581/1346076
http://www.shuijingwanwq.com/2013/07/30/82/
1. Installing Apache
yum -y install gcc gcc-c++ openssl-devel pcre-develtar xf apr-1.4.6.tar.bz2cd apr-1.4.6./configure --prefix=/usr/local/apr --disable-ipv6make & & make installtar xf apr-util-1.4.1.tar.bz2cd apr-util-1.4.1./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make installtar zxf httpd-2.4.17.tar.gz cd httpd-2.4.17./configure --prefix=/usr/local/ Apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm= eventmake && make installcp build/rpm/httpd.init /etc/init.d/httpdvim / Etc/init.d/httpd &nbSp; httpd=${httpd-/usr/local/apache/bin/httpd} pidfile=${pidfile-/usr/local/apache /logs/${prog}.pid} lockfile=${lockfile-/var/lock/subsys/${prog}} RETVAL=0 # check for 1.3 configuration check13 () { conffile=/etc/httpd/httpd.confecho "Path=/usr/local/apache/bin: $PATH" >> /etc/profile.d/http.sh. /etc/profile.d/ http.shln -s /usr/local/apache/include/ /usr/include/httpdvim /etc/httpd/httpd.conf ServerName localhost:80chkconfig --add httpdchkconfig httpd Onservice httpd start
2. Installation Log Cutting tool Cronolog
wget http://cronolog.org/download/cronolog-1.6.2.tar.gztar xf cronolog-1.6.2.tar.gzcd cronolog-1.6.2./configuremake && make installvim /usr/local/httpd/httpd.conf CustomLog "|/usr/local/sbin/cronolog /log/ Www/access_%y%m%d.log "mkdir -p /log/wwwchmod -r 755 /log/www/ chown - r daemon /log/www/
3, Installation Awstats
tar zxf awstats-7.4.tar.gz mv awstats-7.4 /usr/local/awstatscd /usr/local/ awstats/chown -r root.root /usr/local/awstatschmod +x /usr/local/awstats/wwwroot/ cgi-bin/*.plcd /usr/local/awstats/tools/ ./awstats_configure.pl > perl awstats.pl -update -config=www.test.com vim /etc/awstats/ Awstats.www.test.com.conf logfile= "/log/www/access_%yyyy-24%mm-24%dd-24.log" #日志文件存放路径, where%YYYY-24%MM-24%DD refers to the month-date pattern dirdata= "/var/lib/awstats" #创建生成的数据路径 lang= "cn" #默认语言中文 skiphosts= "127.0.0.1 regex[^192\.168\.] " #本地及内部的访问不做分析统计 LevelForWormsDetection=2 #日志等级, do not count warning logs mkdir - pv /var/lib/awstats chmod 755 /var/lib/awstats/usr/local/awstats/wwwroot/cgi-bin/ Awstats.pl -update -config=www.test.comvim /etc/httpd/httpd.conf <ifmodule !mpm_prefork_module> LoadModule cgid_module modules/mod_cgid.so </IfModule> <Directory "/usr/local/awstats/wwwroot" > Options None allowoverride none require all granted Order allow,deny Allow from 192.168.100.1 </Directory>service httpd Restart
4. Testing
Enter the URL in the browser
Http://www.test.com/awstats/awstats.pl?config=www.test.com
Awstats 7.4 Log Analysis tool configuration