利用lighttpd来部署公司awstats日志分析。
一、安装:
1.cd /home/**/**/tools
2.tar –xvzf lighttpd-1.4.20.tar.gz
3.cd lighttpd-1.4.20
4../configure -prefix=/home/**/**/tools_setuped/lighttpd/
5.make
6.make install
7.OK!
但是,一般会在第四步遇到问题,我也遇到了: configure: error: pcre-config not found, install the pcre-devel package and build with --without-pcre
那么我们需要安装一个软件下载地址:http://sourceforge.net/project/showfiles.php?group_id=10194&package_id=9960&release_id=597811
安装步骤:
wget http://jaist.dl.sourceforge.net/sourceforge/pcre/pcre-7.7.tar.gz
./configure
make
make install
安装完成后再编译lighttpd,回到第四部继续往下。
二、配置:
cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd
mkdir /etc/lighttpd
cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
如果你的Linux是RedHat,那么:
cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd
然后修改/etc/init.d/lighttpd,把
lighttpd="/usr/sbin/lighttpd"
改为
lighttpd=" /home/**/**/tools_setuped/lighttpd/sbin/lighttpd"
此脚本用来控制lighttpd的启动关闭和重起:
# /etc/init.d/lighttpd start
#/etc/init.d/lighttpd stop
# /etc/init.d/lighttpd restart
server.document-root, server.error-log,accesslog.filename需要指定相应的目录
server.document-root = "/home/**/**/tools_setuped/awstats/wwwroot/cgi-bin "
mkdir /home/**/**/tools_setuped/lighttpd/logs
chmod 777 /home/**/**/tools_setuped/lighttpd/logs/
touch /home/**/**/tools_setuped/lighttpd/logs/error.log
chmod 777 /home/**/**/tools_setuped/lighttpd/logs/error.log
touch /home/**/**/tools_setuped/lighttpd/logs/access.log
chmod 777 /home/**/**/tools_setuped/lighttpd/logs/access.log
启动报错如下:
启动 lighttpd:2009-04-23 12:40:28: (configfile.c.1136) base-docroot doesn't exist: /srv/www/htdocs/
如果确实configfile.c文件可以到195上考一个过来。
需要修改/etc/lighttpd/lighttpd.conf这个配置文件中的配置
/srv/www/htdocs/ 这个路径是不存在的。
server.document-root = "/srv/www/htdocs/"
改为
server.document-root = "/home/**/**/tools_setuped/awstats/wwwroot/cgi-bin"
下面加上一行:
alias.url = ( "/awstatsicons" => "/home/**/**/tools_setuped/awstats/wwwroot/icon/" )
修改server.errorlog为:
server.errorlog = "/home/**/**/tools_setuped/lighttpd/logs/lighttpd.error.log"
修改accesslog.filename为:
accesslog.filename = "/home/**/**/tools_setuped/lighttpd/logs/access.log"
修改server.port为:
server.port = 5163
要结合我们的awstats来运用,
再重新启动试试
/etc/init.d/lighttpd restart
Awstats的站点文件在./etc/awstats/下。分析出来的日志文件在/var/lib/awstats下。
需要对/etc/awstats下的频道配置文件里的日志对应的路径跟日志的格式。
评论