码迷,mamicode.com
首页 > Web开发 > 详细

apache安装,镇博

时间:2016-08-24 01:18:17      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:apache

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时,必须使用域名。


本文出自 “linux、win运维知识” 博客,转载请与作者联系!

apache安装,镇博

标签:apache

原文地址:http://liuming66.blog.51cto.com/10684323/1841705

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!