LAMP中的apache源碼包安裝

來源:互聯網
上載者:User

標籤:linux下lamp中的apache的源碼包安裝

apache安裝:

首先,解壓httpd包,進入解壓後的目錄,最先查看INSTALL檔案,查看安裝步驟

接著:

第一步:./configure  (配置編譯參數)

./configure    \

> --prefix=/usr/local/apache2  \    //指定安裝到哪裡

> --with-included-apr  \         //它是httpd要依賴的包,它支援httpd跨平台去運作

> --enable-so  \               //表示啟用DSO

> --enable-deflate=shared  \       //表示動態共用的方式編譯deflate模組

> --enable-expires=shared  \       //表示動態共用的方式編譯expires模組

> --enable-rewrite=shared \        //表示動態共用的方式編譯rewrite模組

> --with-pcre

遇到的問題:

apache安裝遇到的問題:

1.出現:configure: error: no acceptable C compiler found in $PATH

是因為你的機器裡沒有安裝任何C語言編譯器,可以安裝gcc (yum install -y gcc)

2.出現:configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

是因為你的機器沒有安裝zlib包,可以用yum安裝:yum install -y zlib-devel

3.為了避免在make 的時候錯誤,所以最好是提前安裝好一些檔案

解決方案:yum install -y  pcre  pcre-devel  apr  apr-devel

第二步:make (編譯)

第三步:make install (安裝)

檢驗編譯安裝是否成功:echo $?

編譯安裝完成之後,進入你剛才指定的檔案位置(--prefix=/usr/local/apache2)

進入到apache2目錄之後,這個bin裡面的apachectl,是它的開機檔案,你可以這樣啟動:

/usr/local/apache2/bin/apachectl   start

第二種方法:把bin/apachectl複製到/etc/init.d/目錄下並重新命名:

cp   /usr/local/apache2/bin/apachectl    /etc/init.d/httpd

啟動apache的時候,會有這樣一種情況:service httpd  start

出現如下資訊:“httpd:Could not reliably determine the server‘s fully qualified domain name,using localhost.localdomain for ServerName".

解決方案就是:找到你--prefix指定的檔案路徑,進入到apache中,進入conf中,編輯httpd.conf

命令如下:cd  /usr/local/apache2

cd  conf

vi  httpd.conf

開啟這個httpd.conf檔案之後,找到#ServerName  www.example.com:80前面的#去掉,儲存即可

apache的一些常用選項:

/usr/local/apache2/bin/apachectl   -l      //列出靜態模組

/usr/local/apache2/bin/apachectl   -t      //查看設定檔有沒有錯誤)

/usr/local/apache2/bin/apachectl   -M      //把有哪些模組列出來


本文出自 “11842333” 部落格,轉載請與作者聯絡!

LAMP中的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.