Ubuntu13.10源码安装Apache2.4

1.下载Apache2.4.9 http://httpd.apache.org/download.cgi


2.tar httpd-2.4.9压缩包 

    tar -zxvf httpd-2.4.9


3.进入httpd-2.4.9文件夹

    cd httpd-2.4.9


4.下载apr-1.5.1.tar.gz http://apr.apache.org/download.cgi
    如果有apr可以跳过此步骤
    tar apr-1.5.1.tar.gz
    复制apr文件夹到 /usr/local/apache下
    cp -vRp /home/sniper/Downloads/apr-1.5.1 /usr/local/apache
    进入apr文件夹
    cd apr
    编译
    ./configure
    安装

    make & make install


5.下载apr-util-1.5.3.gz http://apr.apache.org/download.cgi
    tar apr-util-1.5.3.gz
    复制到/usr/local/apache下
    cp -vRp /home/sniper/Downloads/apr-util-1.5.3 /usr/local/apache
    重命名
    mv /usr/local/apache/apr-util-1.5.3 /usr/local/apache/apr-util
    进入apr-util文件夹下
    cd /usr/local/apache/apr-util
    编译
    ./configure --with-apr=/usr/local/apache/apr
    安装

    make & make install


6.下载pcre-config http://pcre.org
    tar pcre-8.3.5
    mv 到 /usr/local/apache
    cd /usr/local/apache/pcre-8.3.5
    ./configure 

    make & make install


7.重新安装apr-util


8.进入httpd目录

    cd /home/sniper/httpd


9.编译
    ./configure --prefix=/usr/local/apache

    make & make install


10.启动apache
    bin/apachectl start 
    如果出现 /usr/local/apache/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    的错误,输入
    sudo ldconfig
    重新启动服务
    如果出现
/usr/local/apache/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory错误
    打开配置文件 vim /usr/local/apache/conf/httpd.conf
    找到 #ServerName www.example.com:80 把 # 注释去掉,重启

    重启命令:bin/apachectl restart


11.添加测试文件 /usr/local/apache/htdocs/test.html hello world !


12.浏览器中输入 http://localhost/test.html 


13.关闭apache bin/apachectl stop


你可能感兴趣的:(Ubuntu13.10源码安装Apache2.4)