[root@www ~]# tar zxf awstats-6.9.tar.gz -C /usr/local/
[root@www ~]# mv /usr/local/awstats-6.9 /usr/local/awstats
[root@www ~]# cd /usr/local/awstats/tools
|
[root@www tools]# ./awstats_configure.pl
. . . . . . (
此处省略
14
行显示信息
)
1>.
下面选择“
y
”,将
httpd
服务的日志记录格式改为“
combined
”
,
以便记录更多详细信息
(注:以下红色字体是我们要键入或确认的信息)
-----> Check and complete web server config file '/usr/local/apache2/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y
. . . . . . (
此处省略
6
行显示信息
)
2>.
下面选择“
y
”创建新的配置文件。
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.
-----> 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
3>.
定义日志分析的目标网站名称(
www.zou.com
)
.
-----> 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.zou.com
4>.
定义
awstats
配置文件的存放目录(默认为“
/etc/awstats
”)。
-----> 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):
>
-----> Create config file '/etc/awstats/awstats.www.zou.com.conf'
Config file /etc/awstats/awstats.www.zou.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
httpd: unrecognized service
5>.
添加
cron
计划任务(安装脚本无法自动添加,提示用户需手动添加,按回车键继续)。
-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.zou.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue...
6>.
按回车键退出安装脚本
A SIMPLE config file has been created: /etc/awstats/awstats.www.zou.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.zou.com' with command:
> perl awstats.pl -update -config=www.zou.com
You can also read your statistics for 'www.zou.com' with URL:
> http://localhost/awstats/awstats.pl?config=www.zou.com
Press ENTER to finish...
[root@www tools]#
|
[root@www ~]# vi /etc/awstats/awstats.www.zou.com.conf
LogFile="/usr/local/apache2/logs/www.zou.com.access.log"
|
[root@www ~]# mkdir /var/lib/awstats
[root@www ~]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update-config=www.zou.com
Create/Update database for config "/etc/awstats/awstats.www.zou.com.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/usr/local/apache2/logs/www.zou.com.access.log"...
Error: Couldn't open server log file "/usr/local/apache2/logs/www.zou.com.access.log" : No such file or directory
Setup ('/etc/awstats/awstats.www.zou.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
[root@www ~]#
|
[root@www ~]# crontab �Ce
* */5 * * * perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config= www.zou.com
|
[root@www ~]# cat /usr/local/apache2/htdocs/zoucom/aw.html
<html>
<head>
<meta http-equiv=refreshcontent="0;url=http://www.zou.com/awstats/awstats.pl?
config=www.zou.com">
</head>
<body></body>
</html>
[root@www ~]#
|
[root@www ~]# vi /usr/local/apache2/conf/httpd.conf
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "zpp"
AuthType Basic
AuthUserFile /usr/local/awstats/wwwroot/.htpasswd
require valid-user
</Directory>
|
[root@www ~]# cd /usr/local/apache2/bin/
[root@www bin]# ./htpasswd -c /usr/local/awstats/wwwroot/.htpasswd zpp
New password:
Re-type new password:
Adding password for user zpp
[root@www bin]#
|
[root@www bin]# /usr/local/apache2/bin/apachectl restart
[root@www bin]# netstat -anpt | grep :80
tcp 0 0 :::80 :::* LISTEN 20817/httpd
[root@www bin]#
|
Order allow ,deny
Allow from all
|
Order deny,allow
Deny from pan.com
Deny from 200.200.200.1
|
Order allow,deny
Allow from 192.168.0.0/24
Deny from 192.168.0.100
|