linux上邊搭建Apache服務

1.

準備工作:

[root@localhost ~]# rpm  -e  httpd --nodeps

2.

 [root@localhost ~]# mkdir 123   創建一個目錄

 [root@localhost ~]# mount -ousername=administrator //172.16.1.111/123 空格123把宿主機裏面的軟件共享到linux上面

spacer.gif

3.

 [root@localhost123]# tar zxvf httpd-2.2.17.tar.gz  h -C/usr/src 解包

spacer.gif

4.

[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 (配置)

5.

[root@localhost httpd-2.2.17]# make&& make install  (編譯安裝)

6.

[root@localhost httpd-2.2.17]# ls /usr/local/httpd/  (確認安裝結果)

spacer.gif

7.

[root@localhost httpd-2.2.17]# ln -s/usr/local/httpd/bin/* /usr/local/bin/

[root@localhost httpd-2.2.17]# ls -hl/usr/local/bin/ (優化執行路徑)

spacer.gif

8.

[root@localhost ~]# httpd –v  (查看程序版本)

9

[root@localhost ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

添加系統服務

10

[root@localhost ~]# vim /etc/init.d/httpd  添加一下兩行

#chkconfig 35 85 21

#description: Startup script for the apachehttp server

spacer.gif

11.[root@localhost ~]# chkconfig--add httpd   //將httpd添加爲系統服務

[root@localhost ~]# chkconfig --list httpd  //查看httpd服務的自啓動狀態

httpd            0:關閉 1:關閉 2:關閉 3:啓用 4:關閉 5:啓用 6:關閉

spacer.gif

12.

[root@localhost ~]# vim/etc/sysconfig/network 修改localhost爲www

spacer.gif

 

[root@localhost ~]#vim /etc/hosts  添加IP映射

spacer.gif

 

 

[root@localhost ~]# init 6 重啓生效

13.

[root@www ~]# vim/usr/local/httpd/conf/httpd.conf 配置httpd服務

  spacer.gif

修改第97行

14.

[root@www ~]#/usr/local/httpd/bin/apachectl –t  檢查語法

Syntax OK

15.

[root@www~]# /etc/init.d/httpd start   啓動httpd服務

httpd (pid 1763) already running

16.

[root@www ~]# netstat -anpt | grep httpd  查看端口

17.

[root@www~]#cat/usr/src/local/httpd/htdocs/index.html

18.驗證測試

 

 

Linux驗證結果:

spacer.gif

Windows驗證結果:

spacer.gif

 

 

 

部署AWStats分析系統

1.安裝AWStats軟件包

[root@www123]#tar zxvf awstats-7.3  -C /usr/local/

[root@www local]#mv awstats-7.3 awstats

2. 爲統計站點建立配置文件

[root@www]#cd/usr/local/awstats/tools

[root@wwwtools]#chomd a+x awstats_configure.pl

[root@www tools]#./awstats_configure.pl

spacer.gif

spacer.gif屬入httpd.conf的文件路徑 回車 會提示按兩次Y

 

spacer.gif指定要統計的目標網站名稱

spacer.gif

直接按回車

  1. 3.修改站點統計配置文件

[root@www tools]#vim /etc/awstats/awstats.www.benet.com.conf

Logfile="/usr/local/httpd/logs/access_log"(修改這個配置文件)

spacer.gif

  1. 4.mkdir /var/lib/awstats  創建一個指定日誌目錄

執行日誌分析,並設置cron計劃任務

spacer.gif

  1. 5.訪問AWStats

在客戶端屬入 http://benet.com/awstats/awstats.pl?config=www.benet.com


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章