centos7安裝Apache


1、下載安裝包wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.37.tar.gz

2、解壓tar zxvf httpd-2.4.37.tar.gz

3、進入目錄cd httpd-2.4.37/

4、./configure --prefix=/usr/local/apache2/ --enable-rewrite --enable-so

5、出現提示not found APR

6、卸載系統上原有的apr apr-utl

7、yum remove apr apr-util

8、下載新的apr、apr-util安裝wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.gz   wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

9、./configure --prefix=/usr/local/apr;make;make install       

10、./configure --prefix=/usr/local/apr-util;make    make的時候出現錯誤[xml/apr_xml.lo]錯誤

11、解決方法yum install expat-devel    繼續安裝apr-util    make clean;make;make install

12、繼續回到第4步編譯,當還是提示找不到apr或apr-util時,configure執行時直接指定路徑./configure --prefix=/usr/local/apache2/ --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

13、make && make install

14、關閉selinux、防火牆等,開啟Apache服務

15、開啟過程中提示httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message。編輯httpd.conf文件,將ServerAdmin you@example.com前的注釋去掉。編輯/etc/hosts文件,將第一個localhost改為服務器主機名。

16、重啟Apache服務

 

如果make apache時報錯如下

collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 錯誤 1
make[2]: 離開目錄“/usr/local/src/httpd-2.4.27/support”
make[1]: *** [all-recursive] 錯誤 1
make[1]: 離開目錄“/usr/local/src/httpd-2.4.27/support”
make: *** [all-recursive] 錯誤 1

則將解壓出來的apr和apr-util目錄移至/httpd-2.4.27/srclib/目錄

然后重新編譯安裝apr和apr-util


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM