tar zxf awstats-7.2.tar.gz
mv awstats-7.2 /usr/local/awstat
chmod +x /usr/local/awstats/tools/*.pl chmod +x /usr/local/awstats/wwwroot/cgi-bin/*.pl
./awstats_configure.pl Enter full config file path of your Web server. Example: /etc/httpd/httpd.conf Example: /usr/local/apache2/conf/httpd.conf Example: c:\Program files\apache group\apache\conf\httpd.conf Config file path ('none' to skip web server setup): > none #因为是nginx,所以这里跳过。选择“none” 回车 -----> Need to create a new config file ? Do you want me to build a new AWStats config/profile file (required if first install) [y/N] ? y #创建一个新的统计配置 回车 -----> Define config file name to create What is the name of your web site or profile analysis ? Example: www.mysite.com Example: demo Your web site, virtual server or profile name: > www.meihua.info #输入要统计的网站名称 回车 -----> Define config file path In which directory do you plan to store your config file(s) ? Default: /etc/awstats Directory path to store config file(s) (Enter for default): > #默认配置文件的路径/etc/awstats,直接回车 后面就回车到底
vi /etc/awstats/awstats.www.meihua.info.conf LogFile="/data/logs/%YYYY-24/%MM-24/meihua.log.%YYYY-24%MM-24%DD-24.log #日志存放的路径 SiteDomain="www.meihua.info" HostAliases="meihua.info www.meihua.info 127.0.0.1 localhost" DirData="/data/awstats/meihua/" #生成新数据文件的存储路径。要创建
7.生成awstats数据,提供web访问。并做计划任务
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.meihua.info
8.配置apache网站
AddDefaultCharset UTF-8 #支持页面中文。。不然页面会乱码 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/" <Files "awstats.pl"> AllowOverride AuthConfig AuthName "awstats" AuthType Basic AuthUserFile /etc/httpd/.htpasswd Require valid-user </Files>
9.生成访问控制文件
htpasswd /etc/httpd/.htpasswd admin