溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么通過源碼編譯的方式安裝apache2.4

發(fā)布時間:2022-02-18 11:53:47 來源:億速云 閱讀:134 作者:小新 欄目:開發(fā)技術

這篇文章給大家分享的是有關怎么通過源碼編譯的方式安裝apache2.4的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

Apache HTTP Server(簡稱Apache)是Apache軟件基金會的一個開放源碼的網(wǎng)頁服務器,可以在大多數(shù)計算機操作系統(tǒng)中運行,由于其多平臺和安全性被廣泛使用,是最流行的Web服務器端軟件之一。

怎么通過源碼編譯的方式安裝apache2.4

本文檔使用的源碼包地址 鏈接:https://pan.baidu.com/s/110RWf3VC8J3oJhgYq5jU2w 提取碼:pdc0

實戰(zhàn)

[root@Jaking12 ~]# yum install -y gcc  pcre  pcre-devel  expat-devel   bzip2  openssl-devel   zlib*  libtool[root@Jaking12 src]# rz[root@Jaking12 src]# tar xvf apr-1.7.0.tar.gz[root@Jaking12 src]# lsapr-1.7.0  apr-1.7.0.tar.gz
[root@Jaking12 src]# cd apr-1.7.0[root@Jaking12 apr-1.7.0]# ./configure  --prefix=/usr/local/apr[root@Jaking12 apr-1.7.0]# make[root@Jaking12 apr-1.7.0]# make install[root@Jaking12 apr-1.7.0]# cd ..[root@Jaking12 src]# rzrz waiting to receive.
zmodem trl+C ?

 100%     541 KB  541 KB/s 00:00:01       0 Errors..

[root@Jaking12 src]# lsapr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz
[root@Jaking12 src]# tar xf apr-util-1.6.1.tar.gz[root@Jaking12 src]# lsapr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1  apr-util-1.6.1.tar.gz
[root@Jaking12 src]# cd apr-util-1.6.1[root@Jaking12 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr[root@Jaking12 apr-util-1.6.1]# make[root@Jaking12 apr-util-1.6.1]# make install更多的選項可以通過./configure --help 了解
官方的編譯選項文檔http://httpd.apache.org/docs/current/programs/configure.html

--prefix=/usr/local/apache
--sysconfdir=/etc/httpd         //  指定配置文件在安裝在哪個路徑。如不指定,配置文件就在程序安裝的目錄;如指定/etc目錄
--with-apr=/usr/local/apr       // 指定依賴的apr路徑。注意必須指明路徑,否則編譯時會自動去找/usr下的apr,而不是編譯的高版本apr,下同
--with-apr-util=/usr/local/apr-util
--with-mpm=MPM          //指定默認的    [prefork | worker | event] 如3種MPM模塊都編譯了,則通過此項指定默認使用哪種
--with-pcre              //依賴pcre庫用于解決正則表達式問題。    ## 安裝  pcre-devel(兼容Perl的正則表達式庫)--enable-so             //打開 so 模塊,啟用動態(tài)裝載模塊功能
--enable-ssl             //啟用ssl功能。注意要先安裝,https使用
--enable-cgi            //啟用cgi功能,為非線程方式工作的mpm使用
--enable-cgid         //以線程工作(worker/event)的mpm使用
--enable-rewrite     //支持 URL 重寫
--enable-zlib          //通用壓縮機制
--enable-module=most      //[ all | most | ……] 指定啟用哪些模塊??芍付ň唧w的模塊名,也可使用all表示啟用所有模塊,most表示啟用大多數(shù)常用模塊。
                                       一般使用most即可
--enable-mpms-shared=all        //啟用MPM支持的模式,啟用哪種mpm(prefork,worker,event),使用worker或event時要另外一種方式編譯php(編譯時使用了–enable-maintainer-zts選項)
--enable-deflate       //傳輸壓縮機制,節(jié)約帶寬提供對內(nèi)容的壓縮傳輸編碼支持一般是html、js、css等內(nèi)容的站點。使用此參數(shù)會大大
                                提高傳輸速度提升訪問者訪問的體驗。在生產(chǎn)環(huán)境中這是apache調(diào)優(yōu)的一個重要選項之一
[root@Jaking12 apr-util-1.6.1]# cd ..[root@Jaking12 src]# rzrz waiting to receive.
zmodem trl+C ?

 100%    8983 KB 8983 KB/s 00:00:01       0 Errors

[root@Jaking12 src]# lsapr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1  apr-util-1.6.1.tar.gz  httpd-2.4.39.tar.gz
[root@Jaking12 src]# tar xf httpd-2.4.39.tar.gz[root@Jaking12 src]# lsapr-1.7.0         apr-util-1.6.1         httpd-2.4.39
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.39.tar.gz
[root@Jaking12 src]# cd httpd-2.4.39[root@Jaking12 httpd-2.4.39]# ./configure --prefix=/usr/local/apache24  --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-mods-shared=most --enable-mpms-shared=all  --with-mpm=event[root@Jaking12 httpd-2.4.39]# make[root@Jaking12 httpd-2.4.39]# make install所有組件        /usr/local/apache24  
主配置文件    /usr/local/apache24/conf  
啟動腳本       /usr/local/apache24/bin/apachectl

[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules
[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/conf/extra  httpd.conf  magic  mime.types  original
[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/bin/ab         apxs      dbmmanage  envvars-std  htcacheclean  htdigest  httpd      logresolve
apachectl  checkgid  envvars    fcgistarter  htdbm         htpasswd  httxt2dbm  rotatelogs
[root@Jaking12 httpd-2.4.39]# ll /usr/local/apache24/bin/apachectl  -rwxr-xr-x 1 root dip 3440 Mar 10 16:45 /usr/local/apache24/bin/apachectl

啟動 apache2.4

[root@Jaking12 httpd-2.4.39]# /usr/local/apache24/bin/apachectlAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fe2c:fe97%ens33. Set the 'ServerName' directive globally to suppress this message
這是一個提示,問題不大 (⊙o⊙)…

重啟 apache2.4

[root@Jaking12 httpd-2.4.39]# /usr/local/apache24/bin/apachectl graceful

查看 apache2.4 相關信息

[root@Jaking12 httpd-2.4.39]# netstat -pantul | grep 80tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      807/sshd            
tcp6       0      0 :::80                   :::*                    LISTEN      35199/httpd        
tcp6       0      0 :::22                   :::*                    LISTEN      807/sshd  
[root@Jaking12 httpd-2.4.39]# grep DocumentRoot /usr/local/apache24/conf/httpd.conf    # DocumentRoot: The directory out of which you will serve yourDocumentRoot "/usr/local/apache24/htdocs"   # access content that does not live under the DocumentRoot.[root@Jaking12 httpd-2.4.39]# ls /usr/local/apache24/htdocsindex.html
[root@Jaking12 httpd-2.4.39]# cat /usr/local/apache24/htdocs/index.htmlIt works!
怎么通過源碼編譯的方式安裝apache2.4

自定義首頁內(nèi)容

[root@Jaking12 httpd-2.4.39]# vim /usr/local/apache24/htdocs/index.htmlIt works!
Hello World!
怎么通過源碼編譯的方式安裝apache2.4

設置文件共享服務

[root@Jaking12 httpd-2.4.39]# cd /usr/local/apache24/htdocs/[root@Jaking12 htdocs]# lsindex.html
[root@Jaking12 htdocs]# touch file{1..10}[root@Jaking12 htdocs]# lsfile1  file10  file2  file3  file4  file5  file6  file7  file8  file9  index.html
[root@Jaking12 htdocs]# mv index.html index.html.bak[root@Jaking12 htdocs]# lsfile1  file10  file2  file3  file4  file5  file6  file7  file8  file9  index.html.bak
怎么通過源碼編譯的方式安裝apache2.4

感謝各位的閱讀!關于“怎么通過源碼編譯的方式安裝apache2.4”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI