Linux centos 下apache(httpd)编译安装
????1,下載apache(httpd)源碼;
????https://httpd.apache.org/
????2,檢查當前系統中是否已安裝過apache,如安裝過,則需要先卸載;
????3,需要依賴APR,所以要先安裝APR庫支持和PCRE;
? ? APR下載:http://apr.apache.org/download.cgi
????PCRE下載:http://www.pcre.org/
????
????注:編譯pcre時報錯要求安裝c++編譯器: ?
configure: error: You need a C++ compiler for C++ support.
????安裝編譯器即可:
[root@localhost pcre-8.38]# yum install gcc-c++
[root@localhost pcre-8.38]# yum install gcc
------------以下安裝APR+PCRE----------------
[root@localhost apr-1.4.5]# pwd
/usr/local/apr-1.4.5
[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.5]#make?
[root@localhost apr-1.4.5]#make install
[root@localhost apr-util-1.5.4]# pwd
/usr/local/apr-util-1.5.4
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@localhost apr-util-1.5.4]#make
[root@localhost apr-util-1.5.4]#make install
[root@localhost pcre-8.38]#?pwd
/usr/local/pcre-8.38
[root@localhost pcre-8.38]#./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.38]# make
[root@localhost pcre-8.38]# make install
????4,解壓apache,進行安裝即可。
????1)進入當前apache目錄:#./configure --prefix=/usr/local/apache?--with-apr-util=/usr/local/apr-util/??--with-pcre=/usr/local/pcre/
????2)make
????3) make install
????5,完成安裝后進行相關配置。
????啟動httpd服務(實際路徑:/usr/local/apache/bin/apachect1,拷貝到/etc/init.d服務目錄下)
????提示servername未設置:?
[root@localhost?apache]#?/etc/init.d/httpd?restart
AH00558:?httpd:?Could?not?reliably?determine?the?server's?fully?qualified?domain?name,?using?localhost.localdomain.?Set?the?'ServerName'?directive?globally?to?suppress?this?message
[root@localhost?apache]#?
????解決:
[root@localhost?apache]#vi /usr/local/apache/conf/httpd.conf
添加主機名即可:
………………
ServerRoot "/usr/local/apache/"
#+++++++++++++++++++++++++
ServerName localhost:80
#+++++++++++++++++++++++++
………………
????重啟服務不會再提示servername的問題。
????測試httpd://x.x.x.x顯示It works!即說明安裝正常。
關于apr參考:http://blog.sina.com.cn/s/blog_64d912e801018anp.html
轉載于:https://blog.51cto.com/chidongting/1793585
總結
以上是生活随笔為你收集整理的Linux centos 下apache(httpd)编译安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 应对电信劫持强行插入广告的处理
- 下一篇: C# JSON使用的常用技巧(一)