CentOS 7 Apache 2.4.23 安裝 配置 啟動

來源:互聯網
上載者:User

標籤:start   check   顯示   div   efi   handle   direct   --   time   

下載Apache安裝包  httpd-2.4.23.tar.gz

:http://apache.fayea.com/httpd/

Apache 安裝要求

必須安裝APR、APR-Util、PCRE,gcc-c++等包

編譯命令:(除了指定Apache的安裝目錄外,還要安裝apr、apr-util、pcre,並指定參數)

[[email protected] software]# tar -zxvf httpd-2.4.23.tar.gz[[email protected] software]# cd httpd-2.4.23[[email protected] httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuconfigure: configure: Configuring Apache Portable Runtime library...configure: checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.[[email protected] httpd-2.4.23]#

 

在編譯Apache時出現了問題

http://apr.apache.org/download.cgi  下載apr-1.5.2.tar.gz、apr-util-1.5.4.tar.gz
http://www.pcre.org/ 官網
https://sourceforge.net/projects/pcre/files/pcre/  選擇pcre下載,不用pcre2
下載最新版本pcre-8.39.tar.gz

解決apr問題

[[email protected] software]# tar -zxvf apr-1.5.2.tar.gz[[email protected] software]# cd apr-1.5.2/[[email protected] apr-1.5.2]# ./configure --prefix=/usr/local/apr[[email protected] apr-1.5.2]# make[[email protected] apr-1.5.2]# make install

 

解決APR-util問題 

[[email protected] software]# tar -zxvf apr-util-1.5.4.tar.gz[[email protected] software]# cd apr-util-1.5.4/[[email protected] apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config[[email protected] apr-util-1.5.4]# make[[email protected] apr-util-1.5.4]# make install

 

解決pcre-config問題

[[email protected] software]# tar -zxvf pcre-8.39.tar.gz[[email protected] software]# cd pcre-8.39[[email protected] pcre-8.39]# ./configure --prefix=/usr/local/pcre[[email protected] pcre-8.39]# make[[email protected] pcre-8.39]# make install

 

再次編譯httpd-2.4.23:

[[email protected] software]# cd httpd-2.4.23[[email protected] httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre [[email protected] httpd-2.4.23]# make[[email protected] httpd-2.4.23]# make install

 

啟動Apache:/usr/local/apache2/bin/apachectl start
停止Apache:/usr/local/apache2/bin/apachectl stop
重啟Apache:/usr/local/apache2/bin/apachectl restart

網站放在/usr/local/apache2/htdocs目錄下

在IE中通過http://localhost:80,如果看到頁面中顯示“It works!”字樣,則代表Apache驗證通過。如果網站的index尾碼是PHP格式的,則要修改httpd.conf設定檔(/usr/local/apache2/conf),在DirectoryIndex增加 index.php。

## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#<IfModule dir_module>DirectoryIndex index.html index.php</IfModule>

 

CentOS 7 Apache 2.4.23 安裝 配置 啟動

聯繫我們

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