標籤:apache
1、配置IP地址
[[email protected] ~]#vim /etc/sysconfig/network-scripts/ifcfg-eth0
[[email protected] ~]#service network restart
[[email protected] ~]#ifconfig eth0
2、查看並安裝httpd
[[email protected] ~]#rpm -q httpd
[[email protected] ~]#rpm -e httpd --nodeps
[[email protected] ~]#tar -zxvf httpd-2.2.17.tar.gz -C /usr/src/
[[email protected] ~]#cd /usr/src/httpd-2.2.17/
[[email protected] httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so --enable
rewrite --enable-charset-lite --enable-cgi
[[email protected] httpd-2.2.17]# make && make install
[[email protected] ~]#ls /usr/local/httpd/
啟動並查看服務
[[email protected] ~]#/usr/local/httpd/bin/apachectl -t
[[email protected] ~]#/usr/local/httpd/bin/apachectl -v
[[email protected] ~]#/usr/local/httpd/bin/apachectl start
[[email protected] ~]#netstat -anpt | grep 80
[[email protected] ~]#firefox http://192.168.1.1/ &
[[email protected] ~]#echo "/usr/local/httpd/bin/apachectl start" >> /etc/rc.d/rc.local
3、最佳化執行路徑
[[email protected] ~]#ln -s /usr/local/httpd/bin/* /usr/local/bin/
[[email protected] ~]#apachectl -t
4、添加為系統服務
[[email protected] ~]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[[email protected] ~]#chmod +x /etc/init.d/httpd
[[email protected] ~]#vim /etc/init.d/httpd
添加:
#chkconfig:35 85 36
#description:hhhhhhhhh
file:///H|/Y2-linux安全與進階應用程式/第1章:http(一).txt[2015/9/18 12:07:32]
[[email protected] ~]#chkconfig --add httpd
[[email protected] ~]#chkconfig --list
[[email protected] ~]#chkconfig --list | wc -l
[[email protected] ~]#chkconfig --list httpd
[[email protected] ~]#chkconfig httpd on
[[email protected] ~]#chkconfig --level 345 httpd on
[[email protected] ~]#service httpd stop
[[email protected] ~]#service httpd start
[[email protected] ~]#netstat -anpt | grep 80
5、用戶端驗證:
[[email protected] ~]#firefox http://192.168.1.1/ &
二、安裝日誌分析系統
1、解壓並安裝軟體
[[email protected] ~]#tar -zxvf awstats-7.3.tar.gz -C /usr/src/
[[email protected] ~]#mv awstats-7.3/ /usr/local/awstats
2、配置awstats
[[email protected] ~]#cd /usr/local/awstats/tools/
[[email protected] tools]#chmod +x awstats_configure.pl awstats_updateall.pl
[[email protected] tools]#./awstats_configure.pl
[[email protected] tools]#vim /etc/awstats/awstats.www.benet.com.conf
修改:
LogFile="/usr/local/httpd/logs/access_log"
[[email protected] tools]#mkdir /var/lib/awstats
3、設定周期性計劃任務並運行awstats
[[email protected] tools]#./awstats_updateall.pl now
[[email protected] 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]
[[email protected] tools]#service crond restart
[[email protected] tools]#chkconfig --add crond
[[email protected] tools]#chkconfig crond on
4、用戶端訪問:
http://www.benet.com/awstats/awstats.pl
注意:訪問awstats時,必須使用網域名稱。
本文出自 “linux、win營運知識” 部落格,轉載請與作者聯絡!
apache安裝,鎮博