編譯安裝apache2.4

來源:互聯網
上載者:User

標籤:編譯安裝apache web服務軟體



apache軟體介紹:apache是一款web服務軟體,是LAMP架構中的核心組成,支援基於連接埠和IP的虛擬機器,支援連接埠映射,URL重寫,處理動態與靜態web資源的能力強大,可以與PHP經過CGI模組結合處理動態WEB資源,支援的模組相對Nginx要多許多,有prefork,event,wprker三種MPM模式,支援DSO模組動態載入機制,且可以結合Mysql資料庫進行web資源儲存,但對靜態資源的處理不如Nginx強大;一般用nginx作為靜態資源處理伺服器或反向 Proxy伺服器,apache用來處理動態web資源。

根據 www.netcraft.com 的統計Apache-web服務軟體長期市場佔有率在50%以上,最高時達80%,所以編譯安裝Apache是web工程師必須掌握的基本技能。



1:準備開發環境,任何時候想編譯安裝都要裝開發環境


yum groupinstall "Development Tools" "Server Platform Development" -y

安裝pcre-devel

yum install pcre-devel -y



2:安裝apr和apr-util軟體包

#tar xf apr-1.5.0.tar.gz

#cd apr-1.5.0

#./configure --prefix=/usr/local/apr

#make && make install

#tar xf apr-util-1.5.3.tar.gz

#cd apr-util-1.5.3

#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

#make && make install



3:編譯安裝Apache

#tar -xf  httpd-2.4.10.tar.gz

#cd httpd-2.4.10

#./configure --prefix=/usr/local/apache24 

 --with-mpm=worker \apache工作模式為event模型

 --enable-cache \與緩衝相關的

 --enable-disk-cache 

 --enable-modules=most \將大多數常用模組都編譯

 --enable-file-cache

 --with-pcre \支援perl擴充的Regex

 --enable-mods-shared=most \將三個mpm模組prefork.event.worker都編譯

 --enable-so \支援dso動態載入,模組可以按需載入(loadmodule)

 --enable-rewrite \支援URl重寫

 --enable-ssl \支援ssl協議

 --with-apr=/usr/local/apr/ \apr安裝路徑 

 --with-apr-util=/usr/local/apr-util/ \apr-util安裝路徑

 --enable-cgi \支援與php通過cgi結合進行動態網頁處理

 --with-zlib \支援zlib壓縮

 --sysconfdir=/etc/http24 \指定新裝的httpd設定檔路徑 

#make && make install



4:安裝完成後的檔案

#cd /usr/local/apache24

[[email protected] apache24]# ll

total 52

drwxr-xr-x.  2 root root  4096 Oct 29 14:20 bin /Apache內建的二進位命令

drwxr-xr-x.  2 root root  4096 Oct 29 14:20 build /apache24/build/config.nice 檔案可以查                                   /看你編譯安裝時使用的命令

drwxr-xr-x.  2 root root  4096 Oct 29 14:20 cgi-bin

drwxr-xr-x.  3 root root  4096 Oct 29 14:20 error /錯誤頁面顯示內容

drwxr-xr-x.  2 root root  4096 Oct 29 13:46 htdocs /網頁檔案存放位置,而不是/var/www

drwxr-xr-x.  3 root root  4096 Oct 29 14:20 icons

drwxr-xr-x.  2 root root  4096 Oct 29 14:20 include /安裝的Apache標頭檔

drwxr-xr-x.  2 root root  4096 Oct 29 14:35 logs /日誌

drwxr-xr-x.  4 root root  4096 Oct 29 14:20 man /手冊,協助文檔

drwxr-xr-x. 14 root ro:ot 12288 Jul  1 01:15 manual /官方文檔

drwxr-xr-x.  2 root root  4096 Oct 29 14:20 modules /模組

  



5:安裝完成,啟動


#/usr/local/apache24/bin/apachectl start

#Firefox瀏覽器輸入192.168.139.3

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M01/89/79/wKiom1gUUSOQPEs_AAq4Qkz7vzU981.png-wh_500x0-wm_3-wmp_4-s_3381846679.png" title="QQworks.png" alt="wKiom1gUUSOQPEs_AAq4Qkz7vzU981.png-wh_50" />




6:輸出標頭檔

#[[email protected] apache24]# ln -sv /usr/local/apache24/include/ /usr/include//httpd

/usr/include//httpd‘ -> `/usr/local/apache24/include/‘



7:輸出庫檔案

[email protected] apache24]# vim /etc/ld.so.conf.d/httpd.conf

寫入 /usr/local/apache24/lib

#ldconfig -v \讓動態連結程式庫為系統所共用



8:添加PATH路徑

#export PATH=/usr/local/apache24/bin:$PATH (這樣可以直接用apachectl start|stop 管理Apache)

#apachectl stop



9:輸出協助手冊

#vim /etc/man.conf

加入 MANPATH=/usr/local/apache24/man


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

編譯安裝apache2.4

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.