源碼安裝Apache

來源:互聯網
上載者:User

標籤:apache


[[email protected] ~]# yum -y install gcc gcc++ zlib zlib-devel

[[email protected] ~]# wget http://apache.fayea.com/httpd/httpd-2.2.27.tar.gz

[[email protected] ~]# rpm -qa |grep httpd

httpd-2.2.15-39.el6.centos.x86_64

httpd-manual-2.2.15-39.el6.centos.noarch

httpd-tools-2.2.15-39.el6.centos.x86_64

[[email protected] ~]# rpm -e --nodeps httpd-2.2.15-39.el6.centos.x86_64 httpd-manual-2.2.15-39.el6.centos.noarch httpd-tools-2.2.15-39.el6.centos.x86_64

[[email protected] ~]# rpm -qa |grep httpd

[[email protected] ~]#

[[email protected] ~]# tar -zxf httpd-2.2.27.tar.gz 

[[email protected] ~]# cd httpd-2.2.27

[[email protected] httpd-2.2.27]# ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so --enable-headers --enable-expires --with-mpm=worker --enable-modules=most --enable-deflate

--prefix=/usr/local/apache2 #指定apache的安裝路徑,預設安裝路徑為/usr/local/apache2
--enable-rewrite #提供URL規則的重寫
--enable-so #啟用apache服務的DSO(Dynamic Shared Objects動態共用目標),即在以後可以以DSO的方式編譯安裝共用模組,這個模組本身不能以DSO方式編譯。
--enable-headers #提供允許對HTTP要求標頭的控制。
--enable-expires #通過設定檔控制HTTP的“Expires:”和“Cache-Control:”頭內容,即對網站圖片、js、css等內容,提供用戶端瀏覽器緩衝的設定。這個是apache調優的一個重要選項之一。
--with-mpm=worker  #選擇apache mpm的模式為worker模式。為worker模式原理是更多的使用線程來處理請求,所以可以處理更多的並發請求。而系統 資源的開銷小玉基於進程的MPM prefork。如果不指定此參數,預設的模式是prefork進程模式。這個是apache調優的一個重要選項之一。
--enable-deflate #提供對內容的壓縮傳輸編碼支援,一般是html、js、css等內容的網站。使用此參數會打打提高傳輸速度,提升訪問者訪問的體驗。在生產環境中,這是apache調優的一個重要選項之一。

[[email protected] httpd-2.2.27]# make && make install

[[email protected] httpd-2.2.27]# ls -al /usr/local/apache2/

total 68

drwxr-xr-x. 15 root root  4096 Dec 12 21:42 .

drwxr-xr-x. 15 root root  4096 Dec 12 21:42 ..

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 bin

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 build

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 cgi-bin

drwxr-xr-x.  4 root root  4096 Dec 12 21:42 conf

drwxr-xr-x.  3 root root  4096 Dec 12 21:42 error

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 htdocs

drwxr-xr-x.  3 root root  4096 Dec 12 21:42 icons

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 include

drwxr-xr-x.  3 root root  4096 Dec 12 21:42 lib

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 logs

drwxr-xr-x.  4 root root  4096 Dec 12 21:42 man

drwxr-xr-x. 14 root root 12288 Dec 12 21:42 manual

drwxr-xr-x.  2 root root  4096 Dec 12 21:42 modules

[[email protected] httpd-2.2.27]# 

[[email protected] httpd-2.2.27]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd


http://192.168.18.131/

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/56/AB/wKioL1SKhznDs3drAACs8dtUV1c970.jpg" title="QQ20141212140824.png" alt="wKioL1SKhznDs3drAACs8dtUV1c970.jpg" />


[[email protected] httpd-2.2.27]# echo "/usr/local/apache2/bin/apachectl start">>/etc/rc.local


Apache設定檔:

[[email protected] ~]# egrep -v ‘^[ ]*#|^$‘ /usr/local/apache2/conf/httpd.conf | nl     1ServerName localhost:80     2ServerRoot "/usr/local/apache2"     3Listen 80     4<IfModule !mpm_netware_module>     5<IfModule !mpm_winnt_module>     6User daemon     7Group daemon     8</IfModule>     9</IfModule>    10ServerAdmin [email protected]    11DocumentRoot "/usr/local/apache2/htdocs"    12<Directory />    13    Options FollowSymLinks    14    AllowOverride None    15    Order deny,allow    16    Deny from all    17</Directory>    18<Directory "/usr/local/apache2/htdocs">    19    Options Indexes FollowSymLinks    20    AllowOverride None    21    Order allow,deny    22    Allow from all    23</Directory>    24<IfModule dir_module>    25    DirectoryIndex index.html    26</IfModule>    27<FilesMatch "^\.ht">    28    Order allow,deny    29    Deny from all    30    Satisfy All    31</FilesMatch>    32ErrorLog "logs/error_log"    33LogLevel warn    34<IfModule log_config_module>    35    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined    36    LogFormat "%h %l %u %t \"%r\" %>s %b" common    37    <IfModule logio_module>    38      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio    39    </IfModule>    40    CustomLog "logs/access_log" common    41</IfModule>    42<IfModule alias_module>    43    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"    44</IfModule>    45<IfModule cgid_module>    46</IfModule>    47<Directory "/usr/local/apache2/cgi-bin">    48    AllowOverride None    49    Options None    50    Order allow,deny    51    Allow from all    52</Directory>    53DefaultType text/plain    54<IfModule mime_module>    55    TypesConfig conf/mime.types    56    AddType application/x-compress .Z    57    AddType application/x-gzip .gz .tgz    58</IfModule>    59<IfModule ssl_module>    60SSLRandomSeed startup builtin    61SSLRandomSeed connect builtin    62</IfModule>[[email protected] ~]#

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/56/AE/wKiom1SKkNqCY5yXAAMs2OZrP3Y449.jpg" title="QQ圖片20141212145330.png" alt="wKiom1SKkNqCY5yXAAMs2OZrP3Y449.jpg" />

本文出自 “爐火純青” 部落格,請務必保留此出處http://alipay.blog.51cto.com/7119970/1589296

源碼安裝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.