Apache二進位免編譯安裝和參數配置

來源:互聯網
上載者:User

標籤:index   exp   local   支援   pes   分享圖片   .exe   編譯報錯   inux   

  • 下載http相關二進位軟體包
    cd /usr/local/src/wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.34.tar.gzwget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gzwget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz

    說明:
    apr和apr-util是一個通用的函數庫,它讓httpd可以不關心底層的作業系統平台,可以很方便的從linux移植到windos

  • 2.解壓安裝包

    tar zxvf  httpd-2.4.34.tar.gztar zxvf apr-1.6.3.tar.gztar zxvf  apr-util-1.6.1.tar.gz

    3.編譯安裝 apr-1.6.3

    cd apr-1.6.3./configure --prefix=/usr/local/apr

    報錯01:

    [[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/aprchecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking target system type... x86_64-pc-linux-gnuConfiguring APR libraryPlatform: x86_64-pc-linux-gnuchecking for working mkdir -p... yesAPR Version: 1.6.3checking for chosen layout... aprchecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/usr/local/apr-1.6.3‘:configure: error: no acceptable C compiler found in $PATHSee `config.log‘ for more details[[email protected] apr-1.6.3]# echo $?1

    解決辦法:安裝gcc

    yum install gcc -y

    再次config編譯成功

    [[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/apr

    [[email protected] apr-1.6.3]#make && make install[[email protected] apr-1.6.3]# echo $?0

    4.編譯安裝apr-util-1.6.1

    cd /usr/local/src/apr-util-1.6.1./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install

    編譯安裝報錯


    解決報錯:安裝expat庫

    yum install expat-devel -y

    再次執行make && make install,報錯解決

    5.編譯安裝httpd-2.4.29

    cd /usr/local/src/httpd-2.4.29./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-so \   ##支援動態擴充模組,apache支援以一個動態模組存在,Apache本身就是一個進程服務--enable-mods-shared=most

    編譯報錯01:configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

    解決辦法:yum install pcre-devel -y

    再次執行./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most返回如下介面,表示configure編譯成功

    注:如果在編譯過程中出現,缺少某個依賴包,解決思路yum list |grep 包然後安裝devel關鍵字的軟體包yum install -y 軟體包

    make && make install 編譯安裝報錯

    說明:缺少了xml相關的庫,需要安裝libxml2-devel包。直接安裝並不能解決問題,因為httpd調用的apr-util已經安裝好了,但是apr-util並沒有libxml2-devel包支援
    解決辦法:

    參考78829184

    重新安裝libxml2-devel

    yum install -y libxml2-devel

    刪除apr-util軟體包

    rm -rf /usr/local/src/apr-util-1.6.1cd /usr/local/src/

    重新編譯安裝apr-util

    tar zxvf apr-util-1.6.1.tar.gzcd apr-util-1.6.1/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install

    [[email protected] apr-util-1.6.1]# pwd/usr/local/src/apr-util-1.6.1[[email protected] apr-util-1.6.1]# cd ..[[email protected] src]#[[email protected] src]# cd httpd-2.4.34[[email protected] httpd-2.4.34]#[[email protected] httpd-2.4.34]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most返回下面介面說明configure這步編譯成功

    make && make install返回下面介面說明make && make install 執行成功

    [email protected] httpd-2.4.29]# cd /usr/local/apache2.4/[[email protected] apache2.4]# lsbin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules說明:bin目錄:命令執行conf目錄:設定檔所在目錄htdocs目錄:預設網站訪問的內容就存在這個目錄下logs日誌目錄:訪問日誌,服務報錯日誌modules目錄:存放apache需要的模組[[email protected] apache2.4]# ls ./modules/

    [[email protected] apache2.4]# ls ./htdocs/index.html[[email protected] apache2.4]# ls ./bin/

    [[email protected] apache2.4]# ls ./logs/[[email protected] apache2.4]# ls ./conf/extra  httpd.conf  magic  mime.types  original

    查看apache服務狀態,執行/usr/local/apache2.4/bin/apachectl命令後返回如下提示

    [[email protected] apache2.4]# /usr/local/apache2.4/bin/apachectlAH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName‘ directive globally to suppress this message

    解決辦法:
    編譯/usr/local/apache2.4/conf/httpd.conf檔案,把參數 ServerName改為

    ServerName localhost

    注意:這裡的localhost表示本機主機名稱,主機名稱可以自訂為其他
    然後重啟apache服務

    [[email protected] src]# /usr/local/apache2.4/bin/apachectl restart[[email protected] src]# /usr/local/apache2.4/bin/apachectlhttpd (pid 71429) already running

    查看apache載入的模組

    /usr/local/apache2.4/bin/httpd -M

    說明: apache會載入兩種類型的模組static:靜態模組shared:動態模組兩者的區別在於,static模組是已經編譯安裝到/usr/local/apache2.4/bin/httpd設定檔中,而shared表示apache動態載入的模組

    啟動apache服務

    /usr/local/apache2.4/bin/apachectl start

    查看apache服務進程

    [[email protected] ~]# ps aux |grep httpdroot       1463  3.0  0.2 253600  8828 ?        Ss   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1464  2.0  0.2 540428  8916 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1465  2.0  0.2 540428  8916 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1470  1.0  0.2 540428  8912 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startroot       1549  0.0  0.0 112704   972 pts/1    R+   04:19   0:00 grep --color=auto httpd

    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.