centos6.5下Apache 安裝

來源:互聯網
上載者:User

標籤:安裝   伺服器   apache   

1.下載apache  www.apache.org 找到相應的地址複製後 weget即可,也可以用下面這個


wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.23.tar.gztar -xf httpd-2.4.23.tar.gz./configure --prefix=/application/apache2.4.23--enable-deflate --enable-expires--enable-header --enable-modules=most --enable-rewrite--enable-so--with-mpm=worker

解釋一下上面的參數:

--prefix 安裝路徑

--enable-modules=most 使用大部分常用模組

--enable-rewrite 重寫模組

--with-mpm=work 運行方式為一個主進程若干個子線程,還可以配置為進程,配置為進程的優點是更穩定,但是同時也更慢,更耗費cpu資源,當前主流都是把apache作為靜態伺服器使用所以使用work就可以了。如果你要和php等程式做配合可以設定為進程方式工作。


2.進行到這一步的時候出現了錯誤提示找不到apr,逐回到apache.org下載 apr和apr-util


wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz./configure --prefix=/application/aprmakemake installwget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz ./configure --prefix=/application/apr-util --with-apr=/application/aprmakemake install


3.重新安裝apache,進入apache解壓縮目錄


./configure --prefix=/application/apache2.4.23--enable-deflate --enable-expires--enable-header --enable-modules=most --enable-rewrite--enable-so--with-mpm=worker--with-apr=/application/apr --with-apr-util=/application/apr-util


4.繼續報錯

checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

這是因為沒有安裝zlib包,逐 yum 安裝之

yum install zlib-devel


5.ok 裝好後繼續 make apache 這次沒有問題了 繼續 make install 至此安裝完畢


6.修改/application/apache2.4.23/conf/httpd.conf 

找到#ServerName去掉# 更改為: ServerName localhost:80

7.啟動apache

/application/apache2.4.23/bin/httpd -k start


8.測試一下

curl 本機ip 如果 返回 it works 證明apache已經可以正常運行了


本文出自 “12131629” 部落格,請務必保留此出處http://12141629.blog.51cto.com/12131629/1881734

centos6.5下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.