1、配置IP地址
[root@localhost ~]#vim /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]#service network restart
[root@localhost ~]#ifconfig eth0
2、查看并安装httpd
[root@localhost ~]#rpm -q httpd
[root@localhost ~]#rpm -e httpd --nodeps
[root@localhost ~]#tar -zxvf httpd-2.2.17.tar.gz -C /usr/src/
[root@localhost ~]#cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so --enable
rewrite --enable-charset-lite --enable-cgi
[root@localhost httpd-2.2.17]# make && make install
[root@localhost ~]#ls /usr/local/httpd/
启动并查看服务
[root@localhost ~]#/usr/local/httpd/bin/apachectl -t
[root@localhost ~]#/usr/local/httpd/bin/apachectl -v
[root@localhost ~]#/usr/local/httpd/bin/apachectl start
[root@localhost ~]#netstat -anpt | grep 80
[root@localhost ~]#firefox http://192.168.1.1/ &
[root@localhost ~]#echo "/usr/local/httpd/bin/apachectl start" >> /etc/rc.d/rc.local
3、优化执行路径
[root@localhost ~]#ln -s /usr/local/httpd/bin/* /usr/local/bin/
[root@localhost ~]#apachectl -t
4、添加为系统服务
[root@localhost ~]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost ~]#chmod +x /etc/init.d/httpd
[root@localhost ~]#vim /etc/init.d/httpd
添加:
#chkconfig:35 85 36
#description:hhhhhhhhh
file:///H|/Y2-linux安全与高级应用/第1章:http(一).txt[2015/9/18 12:07:32]
[root@localhost ~]#chkconfig --add httpd
[root@localhost ~]#chkconfig --list
[root@localhost ~]#chkconfig --list | wc -l
[root@localhost ~]#chkconfig --list httpd
[root@localhost ~]#chkconfig httpd on
[root@localhost ~]#chkconfig --level 345 httpd on
[root@localhost ~]#service httpd stop
[root@localhost ~]#service httpd start
[root@localhost ~]#netstat -anpt | grep 80
5、客户端验证:
[root@localhost ~]#firefox http://192.168.1.1/ &
二、安装日志分析系统
1、解压并安装软件
[root@localhost ~]#tar -zxvf awstats-7.3.tar.gz -C /usr/src/
[root@localhost ~]#mv awstats-7.3/ /usr/local/awstats
2、配置awstats
[root@localhost ~]#cd /usr/local/awstats/tools/
[root@localhost tools]#chmod +x awstats_configure.pl awstats_updateall.pl
[root@localhost tools]#./awstats_configure.pl
[root@localhost tools]#vim /etc/awstats/awstats.www.benet.com.conf
修改:
LogFile="/usr/local/httpd/logs/access_log"
[root@localhost tools]#mkdir /var/lib/awstats
3、设置周期性计划任务并运行awstats
[root@localhost tools]#./awstats_updateall.pl now
[root@localhost tools]#crontab -e -u root
添加:
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
file:///H|/Y2-linux安全与高级应用/第1章:http(一).txt[2015/9/18 12:07:32]
[root@localhost tools]#service crond restart
[root@localhost tools]#chkconfig --add crond
[root@localhost tools]#chkconfig crond on
4、客户端访问:
http://www.benet.com/awstats/awstats.pl
注意:访问awstats时,必须使用域名。