linux上邊搭建Apache服務
1.
準備工作:
[[email protected] ~]# rpm -e httpd --nodeps
2.
[[email protected] ~]# mkdir 123 (創建一個目錄)
[[email protected] ~]# mount -ousername=administrator //172.16.1.111/123 空格123(把宿主機裏面的軟件共享到linux上面)
3.
[[email protected]]# tar zxvf httpd-2.2.17.tar.gz h -C/usr/src (解包)
4.
[[email protected]
[[email protected] httpd-2.2.17]# ./configure--prefix=/usr/local/httpd --enable-so--enable-rewrite --enable-charset-lite --enable-cgi (配置)
5.
[[email protected] httpd-2.2.17]# make&& make install (編譯安裝)
6.
[[email protected] httpd-2.2.17]# ls /usr/local/httpd/ (
7.
[[email protected] httpd-2.2.17]# ln -s/usr/local/httpd/bin/* /usr/local/bin/
[[email protected] httpd-2.2.17]# ls -hl/usr/local/bin/ (優化執行路徑)
8.
[[email protected] ~]# httpd –v (查看程序版本)
9.
[[email protected] ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
(添加系統服務)
10.
[[email protected] ~]# vim /etc/init.d/httpd (添加一下兩行)
#chkconfig 35 85 21
#description: Startup script for the apachehttp server
11.[[email protected] ~]# chkconfig--add httpd (//將httpd添加為系統服務)
[[email protected] ~]# chkconfig --list httpd (//查看httpd服務的自啟動狀態)
httpd 0:關閉 1:關閉 2:關閉 3:啟用 4:關閉 5:啟用 6:關閉
12.
[[email protected] ~]# vim/etc/sysconfig/network (修改localhost為www)
[[email protected] ~]#vim /etc/hosts 添加IP映射
[[email protected] ~]# init 6 重啟生效
13.
[[email protected] ~]# vim/usr/local/httpd/conf/httpd.conf (配置httpd服務)
修改第97行
14.
[[email protected] ~]#/usr/local/httpd/bin/apachectl –t (檢查語法)
Syntax OK
15.
[[email protected]~]# /etc/init.d/httpd start (啟動httpd服務)
httpd (pid 1763) already running
16.
[[email protected] ~]# netstat -anpt | grep httpd (查看端口)
17.
[[email protected]~]#cat/usr/src/local/httpd/htdocs/index.html
18.驗證測試
Linux驗證結果:
Windows驗證結果:
部署AWStats分析系統
1.安裝AWStats軟件包
[[email protected]]#tar zxvf awstats-7.3 -C /usr/local/
[[email protected] local]#mv awstats-7.3 awstats
2. 為統計站點建立配置文件
[[email protected]]#cd/usr/local/awstats/tools
[[email protected]]#chomd a+x awstats_configure.pl
[[email protected] tools]#./awstats_configure.pl
屬入httpd.conf的文件路徑 回車 會提示按兩次Y
指定要統計的目標網站名稱
直接按回車
3.修改站點統計配置文件
[[email protected] tools]#vim /etc/awstats/awstats.www.benet.com.conf
Logfile="/usr/local/httpd/logs/access_log"(修改這個配置文件)
4.mkdir /var/lib/awstats 創建一個指定日誌目錄
執行日誌分析,並設置cron計劃任務
5.訪問AWStats
在客戶端屬入 http://benet.com/awstats/awstats.pl?config=www.benet.com
本文出自 “12323622” 博客,請務必保留此出處http://12333622.blog.51cto.com/12323622/1922274
linux上邊搭建Apache服務