httpd-2.4新特性簡單安裝(無php、無mysql)

pathfinder_cui發表於2015-08-22
httpd-2.4新特性
  1.MPM支援在執行時裝載
    --enable-mpms-shared=all 啟用在執行時切換
    --with-mpm-event         預設使用MPM
  2.支援event
  3.支援非同步讀寫
  4.在每模組以及每目錄上指定日誌及級別
  5.每請求配置:<If>,<Elseif>
  6.增強表示式分析器
  7.毫秒級keepalive timeout
  8.支援主機名的虛擬主機不在需要NameVirtualHost指令
  9.支援使用自定義變數
新增一些模組:mod_proxy_fcgi,mod_ratelimit,mod_request,mod_remoteip
對於基於IP的訪問做了修改,不在使用order,allow,deny這些機制;而是統一使用require進行

原始碼編譯安裝
依賴更高版本的apr和apr-util,apr全稱為apache portable runtime
httpd2.4需要apr1.4以上版本
yum install -y pcre-devel gcc* wget lrzsz
wget /> wget /> wget /> tar xf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
cd

tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd

tar xf httpd-2.4.16.tar.gz
cd httpd-2.4.16
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl  --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-modules=most --enable-mpms-shared=all --with-event

--enable-so :支援動態載入模組
--enable-rewrite :支援url重寫
--with-zlib  :使用網路上的通用壓縮庫
--with-pcre :支援perl
--enable-modules :企業大多數或所有的module

通常編譯一個關鍵是都需要匯出4種檔案:標頭檔案、庫檔案、幫助檔案、執行檔案
1.匯出標頭檔案
 ln -sv /usr/local/apache/include /usr/include/httpd
2.匯出庫檔案
  vim /etc/ld.so.conf.d/xxx.conf
  ldconfig

  ldconfig -p
3.man -M /usr/local/apache/man  httpd

4.輸出二進位制程式
vim /etc/profile.d/httpd.sh
export PATH=/usr/local/apache/bin:$PATH

檢視當前正在執行的MPM和版本
httpd -V

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29620572/viewspace-1779850/,如需轉載,請註明出處,否則將追究法律責任。

相關文章