Ubuntu 下配置apache和APR


軟件環境:ubuntu14.04  虛擬機Vmware  軟件:http://httpd.apache.org/  httpd-2.2.29.tar.gz  不需要單獨下載APR。

1.解壓apache源碼
# tar xvzf httpd-2.2.29.gz
# cd httpd-2.2.29
2.安裝apr
# cd srclib/apr
# ./configure --prefix=/usr/local/apr //配置到指定目錄
# make
# make install %需要再root模式下運行 前面加sudo
3.安裝apr-util
# cd ../apr-util/
# ./configure --prefix=/usr/local/apr-util 
    --with-apr=/usr/local/apr
# make
# make install %需要root權限 前面加sudo
# cd ../../
4.安裝apache

#./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-mods-shared=all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-rewrite--enable-status --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ 
%如果有錯誤
mod_deflate has been requested but can not be built due to prerequisite failures(ubuntu centent) 那是沒有安裝zlib包。centos下可以采用yum install zlib-devel, ubuntu下可以采用apt-get install zlib1g-dev.

# make
# make install 同上

5. 安裝tomcat-native.tar.gz  //暫時沒配
# cd /opt/tomcat/bin
# tar zxvf tomcat-native.tar.gz
# cd tomcat-native-src/jni/native
# ./configure --with-apr=/usr/local/apr

 6. 添加環境變量

# vim /etc/profile
添加:export LD_LIBRARY_PATH=/usr/local/apr/lib

 7. 啟動與停止

啟動:sudo /usr/local/apache2/bin/httpd -k start

啟動時提示:

httpd: Could not determine the servers fully qualified domain name, using 127.0.0.1 for ServerName.
解決辦法1是在http.conf中加一行:%%http.conf在/usr/local/apache2/conf/下
ServerName 127.0.0.1:80

或者2.找到#ServerName www.example.com:80   把#去掉,再重啟apache即可沒事了。

否則,只能在本地用127.0.0.1訪問,不能使別的電腦訪問網站

停止:sudo /usr/local/apache2/bin/httpd -k stop

 

 

 


免責聲明!

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



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