zoukankan      html  css  js  c++  java
  • (一)lamp 环境搭建之编译安装apache

    apache的编译安装:

      安装步骤大概参考:http://www.cnblogs.com/iyoule/archive/2013/10/24/3385540.html

    简单的将分为三步:

      (1)安装apache的依赖库:apr,apr-util,prce。

      (2)移动apr和apr-util到指定目录下。

      (3)安装apache。

    1,apache 的 servername 报错一般解决方法:
    在httpd.conf文件中更改 ServerName 192.168.1.77:80 这行的域名改为ip即可。

    2,取消apache默认的欢迎页面
    注释/conf.d 文件夹中的welcome 页

    4,apache2.4 以上支持php-fpm,也就是fastcgi连接php。

    5,apache编译安装报错 apr not found
    解决:下载apr,apr-util 包。解压安装。
    再编译apache时 加上 --with-apr=/apr目录 --with-apr-util=/apr-util目录

    6,apr-util-1.6.1 报错
    xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

    解决方法(缺少expat库)
    yum install expat-devel -y

    yum install -y pcre*

    7,make apache报错:
    collect2: error: ld returned 1 exit status
    Makefile:48: recipe for target 'htpasswd' failed
    make[2]: *** [htpasswd] Error 1
    make[2]: Leaving directory '/etc/httpd-2.4.27/support'
    /etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/etc/httpd-2.4.27/support'
    /etc/httpd-2.4.27/build/rules.mk:75: recipe for target 'all-recursive' failed
    make: *** [all-recursive] Error 1
        
    这个错误是因为在httpd目录下的srclib目录里面没有apr和apr-util所导致的,
    但是./configure又不会报错,到make才会报错,所以把下载下来到apr和apr-util解
    压到srclib目录下到apr和apr-util目录,注意目录名字要一致。
    这个需要注意顺序,最好在make apaceh的解压文件之前将apr和apr-util移动过来

    8,将apache加入系统服务的步骤:

    可以简单地把Apache启动命令加到/etc/rc.local文件,
    让Apache随系统启动而自动启动(一般不这样做):
    # echo"/usr/local/apache-2.2.6/bin/apachectl start" >> /etc/rc.local

    下面介绍如何把Apache加入到系统服务,用service命令来控制Apache的启动和停止。
    首先以apachectl脚本为模板生成Apache服务控制脚本:

    grep -v "#"/usr/local/apache/bin/apachectl > /etc/init.d/apache

    这一步完成后就可以使用 /etc/init.d/apache start 来启动apache了。

    用vi编辑Apache服务控制脚本/etc/init.d/apache:vi /etc/init.d/apache

    在文件最前面插入下面的行,使其支持chkconfig命令:

    #!/bin/sh
    # chkconfig: 2345 85 15
    # description: Apache is a World Wide Webserver.

    保存后退出vi编辑器,执行下面的命令增加Apache服务控制脚本执行权限:
    chmod +x /etc/init.d/apache
    执行下面的命令将Apache服务加入到系统服务:

    chkconfig --add apache
    执行下面的命令检查Apache服务是否已经生效:
    chkconfig --list apache
    命令输出类似下面的结果则成功:
    apache 0:off 1:off 2:on 3:on 4:on 5:on 6:off

  • 相关阅读:
    Ant利用第三方的task
    读《NoSQL精粹》前三章有感
    opensuse12.3 桌面设置备忘录
    clojure中符号symbols 和变量vars的正确理解
    vim配置clojure开发环境备忘录
    移动端调试痛点?——送你五款前端开发利器
    SyntaxError: missing ) after argument list
    铺满屏幕的布局方法
    剖析height百分比和min-height百分比
    父元素高度设置为min-height,子元素高度设置为100%,但实际上子元素高度你知道是多少吗?(2019-10-26更新)
  • 原文地址:https://www.cnblogs.com/fengfengyang/p/9858534.html
Copyright © 2011-2022 走看看