zoukankan      html  css  js  c++  java
  • 编译安装Apache

    Apache依赖apr、apr-util和pcre

    1、下载Apache源码(我用的是httpd-2.2.8_apache.tar.gz)

    2、解压到/usr/src,执行:tar zxvf httpd-2.2.8_apache.tar.gz -C /usr/src

    3、进入目录usr/src/httpd-2.2.8,执行:./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl

    4、出现configure: error: APR not found。解决办法:

      4.1下载apr源码(我用的是apr-1.4.6.tar.gz)

      4.2解压到/usr/src,执行:tar zxvf apr-1.4.6.tar.gz  -C /usr/src/

      4.3进入目录/usr/src/apr-1.4.6,执行:./configure --prefix=/usr/local/apr;make;make install

    5、再次进入目录usr/src/httpd-2.2.8,增加参数--with-apr=/usr/local/apr/,重新执行:重新执行:./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/

    6、出现configure: error: APR-util not found .解决办法

      6.1下载apr-util源码(我用的是apr-util-1.5.2.tar.gz)

      6.2解压到/usr/src,执行 tar zxvf apr-util-1.5.2.tar.gz  -C /usr/src/

      6.3进入目录/usr/src/apr-util-1.5.2,执行./configure --prefix=/usr/local/apr-util;make;make install

    7、再次进入目录usr/src/httpd-2.2.8,增加参数--with-apr-util=/usr/local/apr-util/,重新执行:./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/

    8、出现configure: error: pcre-config for libpcre not found.解决办法:

      8.1下载pcre源码(我用的是pcre-8.21.tar.gz)

      8.2解压到/usr/src,执行tar zxvf pcre-8.21.tar.gz  -C /usr/src/

      8.3进入目录/usr/src/pcre-8.21,执行./configure --prefix=/usr/local/pcre;make;make install

    9、再次进入目录usr/src/httpd-2.2.8,增加参数--with-pcre=/usr/local/pcre,重新执行:./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

    10、出现configure: WARNING: OpenSSL version is too old;checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures;解决办法:

      10.1下载openssl源码(我用的是openssl-1.0.2a.tar.gz)

      10.2解压到/usr/src,执行 tar zxvf openssl-1.0.2a.tar.gz  -C /usr/src/

      10.3进入目录/usr/src/openssl-1.0.2,执行./config --prefix=/usr/local/openssl;make;make install

    11、再次进入目录usr/src/httpd-2.2.8,增加参数--with-ssl=/usr/local/openssl,重新执行:./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --with-ssl=/usr/local/openssl ;make ;make install;

    12、启动apache,进入/usr/local/apache2/bin目录,执行命令sudo ./httpd -k stop/start/restart 

    13、设置httpd在任何目录下都可以运行,打开vim /etc/environment,增加配置/usr/local/apache2/bin

    14、浏览器输入本机ip,可以显示apche自带的网页,如图所示,即表示安装Apache成功

    15、遇到的问题及解决方法

      15.1都安装好了,但还是访问不了,可能是防火墙开启了,关闭防火墙即可。输入命令:chkconfig iptables off,

      15.2在root下执行apachectl start/stop失败,报错:httpd: Could not reliably determine the server's fully qualified domain name。

          解决办法:(1)进入apache的安装目录:(视个人安装情况而不同) [root@server ~]# cd /usr/local/apache/conf 
           (2)编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80

                       (3)重新启动apache 即可。执行apachectl restart

      15.3在pcre编译安装,make报错,可能是缺少系统包造成的,输入命令yum -y install gcc-c++,重新configure,make && make install

      

    参考于:http://www.cnblogs.com/alexqdh/archive/2012/11/20/2764810.html

  • 相关阅读:
    LeetCode Minimum Path Sum
    第六章-2-数组练习
    第六章-1-数组练习
    第五章-for循环的练习
    第四章:if else switch使用
    第三章
    实训篇-JavaScript-打地鼠
    实训篇-Html-注册页面【简单】
    实训篇-Html-计算器
    实训篇-JavaScript-陶渊明去没去过桃花源
  • 原文地址:https://www.cnblogs.com/fun0623/p/4366065.html
Copyright © 2011-2022 走看看