1、在web1和web2上分别部署awstats
[root@web1 Desktop]# mv /usr/local/awstats-6.9/ /usr/local/awstats
[root@web1 Desktop]# cd /usr/local/awstats/tools/
[root@web1 tools]# ./awstats_configure.pl
51 LogFile="/usr/local/apache2/logs/www.eyo.com.access.com"
[root@web1 tools]# perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.eyo.com
这里需要格外注意:执行第一次时,可能不会报错,因为日志里面根本不存在任何信息,所以你可以试着在本机上访问http://www.eyo.com进行测试,确定生成了日志之后,再执行上一条命令,很可能会报错:
Your log file /usr/local/apache2/logs/www.eyo.com.access.com must have a bad format or LogFormat parameter setup does not match this format.
httpd: Syntax error on line 414 of /usr/local/apache2/conf/httpd.conf: /usr/local/apache2/conf/httpd.conf:414: <VirtualHost> was not closed.
[root@web1 logs]# rm -fr www.eyo.com.*
[root@web1 logs]# /usr/local/apache2/bin/apachectl restart
Create/Update database for config "/etc/awstats/awstats.www.eyo.com.conf" by AWStats version 6.9 (build 1.925)
From data in log file "/usr/local/apache2/logs/www.eyo.com.access.com"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 154
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 154 new qualified records.
[root@web1 ~]# service crond restart
停止 crond: [确定]
启动 crond: [确定]
[root@web1 ~]# chkconfig crond on
但是使用上述地址访问awstats页面时,URL信息太长,可以做一个自动跳转的HTML网页,以简化输入:
[root@web1 ~]# vim /usr/local/apache2/htdocs/aw.html
<html>
<head>
<meta http-equiv=refresh content="0;url=http://web2.eyo.com/awstats/awstats.pl?config=www.eyo.com">
</head>
<body></body>
</html>
当访问http://web1.eyo.com/aw.html时,将自动跳转到awstats的日志分析报告页面,
在web2上进行以上全部同样的配置即可
[root@web1 Desktop]# mv phpMyAdmin /usr/local/apache2/htdocs/
[root@web1 Desktop]# cd /usr/local/apache2/htdocs/phpMyAdmin/
[root@web1 phpMyAdmin]# cp config.sample.inc.php config.inc.php
[root@web1 phpMyAdmin]# vim config.inc.php (密码非空即可)
17 $cfg['blowfish_secret'] = '123'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
在phpMyAdmin的web页面下方,可能会出现“无法载入mcrypt扩展,请检查PHP配置”的错误提示信息,这是由于没有mcrypt加密算法扩展库造成的,可以忽略
# File: /var/scripts/mysql.sh
# Database info
DB_NAME="test"(如果是备份所有数据库,则可以不用定义此变量)
DB_USER="root"
DB_PASS="cssl#123"
BIN_DIR="/usr/local/mysql/bin"
BCK_DIR="/var/backup/mysql"
DATE=`date +%F`
[root@web1 ~]# mkdir -p /var/backup/mysql
[root@web1 ~]# chmod a+x /var/scripts/mysql.sh
[root@web1 ~]# crontab -e
30 5 * * * /var/scripts/mysql.sh (一般在闲时每天备份一次)
可以先进行一次测试:
[root@web1 ~]# /var/scripts/mysql.sh
[root@web1 ~]# ls /var/backup/mysql/
db_2011-07-11-all.sql.gz
以上的所有步骤在两台服务器上均需配置!