杨叔叔 发表于 2018-11-15 10:06:43

nginx awstats配置

  1.下载安装包
  wget http://prdownloads.sourceforge.net/awstats/awstats-7.0.tar.gz
  #tar zxvf awstats-7.0.tar.gz
  2.建立awstats安装目录
  #mkdir /usr/local/awststs
  #cp -ar awstats-7.0/* /usr/local/awstats
  3.安装awstats
  #cd/usr/local/awststs
  #perl /usr/local/awstats/tools/awstats_configure.pl
  按照提示设置
  webserver config file path:none
  config file name:test.com
  config file path:默认(/etc/awstats)
  4.配置awstats
  #vim /etc/awstats/awstats.test.com.conf
  LogFile="/home/wwwlogs/access.log" #服务器访问日志文件
  5. 生成日志数据
  #mkdir /var/lib/awstats
  #/usr/local/awstats/wwwroot/cgi-bin/awstats.pl --update --config=test.com
  6.生成静态网页文件
  # /usr/local/awstats/tools/awstats_buildstaticpages.pl -update-config=test.com -lang=cn -dir=/home/wwwroot/www.test.com/awstats-awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl
  网页文件位置:/home/wwwroot/www.test.com/awstats
  将此条命令行加入crontab来定时生成页面。
  7.调整nginx配置
  #vim /usr/local/nginx/conf/vhost/www.test.com.conf
  添加
  location ^~ /icon/
  {
  root   /usr/local/awstats/wwwroot;# awstats图标目录
  indexindex.html;
  access_log off;
  error_log off;
  charset gb2312;
  }
  #service nginx restart
  8.访问统计页面
  http://www.test.com/awstats/awstats.test.com.html
  问题解决:
  1、统计页面中,“用以搜索的关键字” “用以搜索的词语”字体乱码,如何解决?
  分析:因为现在的搜索引擎都是使用UTF8,而Awstats是使用decodeUTFkeys这个plugin来处理搜索引擎的UTF8关键字,默认是没有打开的,所以在显示上会出现乱码
  解决:启用 DecodeUTFKeys,在 /etc/awstas/awstats.yourdomain.conf 把 LoadPlugin="decodeutfkeys"的注释去掉,根据插件的描述(如下)还要安装Encode and URI::Escape 的perl模块,使用cpan安装cpan> install Encode ; cpan> installURI::Escape

页: [1]
查看完整版本: nginx awstats配置