apache2.4.9安裝

來源:互聯網
上載者:User

標籤:

1、下載所需軟體包

   根據官網所示,安裝apache2.4.9必須先安裝apr、apr-util、pcre包

The following requirements exist for building Apache httpd:APR and APR-UtilMake sure you have APR and APR-Util already installed on your system. If you don‘t, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/) and use ./configure‘s --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.Perl-Compatible Regular Expressions Library (PCRE)This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package. If your build system can‘t find the pcre-config script installed by the PCRE build, point to it using the --with-pcre parameter. On some platforms, you may have to install the corresponding -dev package to allow httpd to build against your installed copy of PCRE.

  

2、安裝

 解壓縮tar -fvxz apr-1.5.1.tar.gztar -fvxz pcre-8.33.tar.gztar -fvxz apr-util-1.5.3.tar.gztar -fvxz httpd-2.4.9.tar.gz 編譯安裝aprcd apr-1.5.1./configure --prefix=/usr/local/apr
make && make install 編譯安裝apr-utilcd ../apr-util-1.5.3./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install 編譯安裝pcrecd ../pcre-8.33./configure --prefix=/usr/local/pcre報錯如下:configure: error: You need a C++ compiler for C++ support安裝gcc和c++yum install -y gcc gcc-c++make && make install 編譯安裝apache 安裝之前請確保系統之前預裝的httpd已被卸載
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event

   

3、錯誤資訊

checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures安裝opensslyum install openssl-develyum update openssl
make && make install

  

4、啟動測試

 /usr/local/apache/bin/apachectl start停止服務:/usr/local/apache/bin/apachectl -k stop

  

 5、添加為service

cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache //拷貝apache啟動指令碼vi /etc/rc.d/init.d/apache    // 這裡是編輯apache啟動指令碼在開頭的#!/bin/sh  下面加上chkconfig: 2345  85  15chkconfig --add apache    //添加apache服務chkconfig --list apache    //列出apache服務service apache stop    //停止apache服務netstat -an | grep :80     //查看linux的80連接埠是否關閉ps -aux | grep httpd     //查看是否存在httpd服務,若果之前內建httpd服務啟動的話會導致新添加的apache服務啟動失敗service apache start    //啟動apache服務

  



linux下安裝apache已經成功了

 

Apache預設的訪問路徑是:/usr/local/apache/htdocs/

apache2.4.9安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.