linux上邊搭建Apache服務

來源:互聯網
上載者:User

標籤:linux

1.

準備工作:

[[email protected] ~]# rpm  -e  httpd --nodeps

2.

 [[email protected] ~]# mkdir 123   (建立一個目錄)

 [[email protected] ~]# mount -ousername=administrator //172.16.1.111/123 空格123(把宿主機裡面的軟體共用到linux上面)

650) this.width=650;" width="540" height="49" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

3.

 [[email protected]]# tar zxvf httpd-2.2.17.tar.gz  h -C/usr/src (解包)

650) this.width=650;" width="461" height="48" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

4.

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

5.

[[email protected] httpd-2.2.17]# make&& make install  (編譯安裝)

6.

[[email protected] httpd-2.2.17]# ls /usr/local/httpd/  (確認安裝結果)

650) this.width=650;" width="385" height="41" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

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/ (最佳化執行路徑)

650) this.width=650;" width="530" height="41" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

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

650) this.width=650;" width="492" height="56" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

11.[[email protected] ~]# chkconfig--add httpd   (//將httpd添加為系統服務)

[[email protected] ~]# chkconfig --list httpd  (//查看httpd服務的自啟動狀態)

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

650) this.width=650;" width="504" height="60" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

12.

[[email protected] ~]# vim/etc/sysconfig/network (修改localhost為www)

650) this.width=650;" width="420" height="93" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

 

[[email protected] ~]#vim /etc/hosts  添加IP映射

650) this.width=650;" width="606" height="115" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

 

 

[[email protected] ~]# init 6 重啟生效

13.

[[email protected] ~]# vim/usr/local/httpd/conf/httpd.conf (配置httpd服務)

  650) this.width=650;" width="596" height="150" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

修改第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驗證結果:

650) this.width=650;" width="554" height="137" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

Windows驗證結果:

650) this.width=650;" width="472" height="177" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

 

 

 

部署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

650) this.width=650;" width="382" height="65" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

650) this.width=650;" width="364" height="40" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/themes/default/images/word.gif") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />屬入httpd.conf的檔案路徑 斷行符號 會提示按兩次Y

 

650) this.width=650;" width="297" height="66" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />指定要統計的目標網站名稱

650) this.width=650;" width="553" height="208" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

直接按斷行符號

  1. 3.修改網站統計設定檔

[[email protected] tools]#vim /etc/awstats/awstats.www.benet.com.conf

Logfile="/usr/local/httpd/logs/access_log"(修改這個設定檔)

650) this.width=650;" width="447" height="75" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

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

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

650) this.width=650;" width="408" height="44" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

  1. 5.訪問AWStats

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


本文出自 “12323622” 部落格,請務必保留此出處http://12333622.blog.51cto.com/12323622/1922274

linux上邊搭建Apache服務

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.