zoukankan      html  css  js  c++  java
  • apache源码安装

    1.apr和apr-util,下载地址: http://apr.apache.org/download.cgi

    yum install gcc
    yum install libtool
    yum install expat-devel
    yum install pcre-devel
    
    cd apr-1.6.3/
    ./configure --prefix=/opt/apr
    

    出现以下错误

    rm: cannot remove 'libtoolT': No such file or directory

    include/arch/unix/apr_private.h is unchange
    cp configure ./configure.bak
    vi configure
    #$RM “$cfgfile”   #注释掉这行
    :wq

    !./configure --prefix #重新执行上一次相同的命令
    make -j 4 #四核运行
    make install

    tar -zxvf apr-util-1.6.1.tar.bz2 #注意不要下载apr-util-1.6.1.tar.gz这个gz文件会出现安装错误
    cd apr-util-1.6.1
    ./configure --prefix=/opt/apr-util --with-apr=/opt/apr
    make && make instal

    2. 下载安装pcre【如果以及yum安装则跳过此步】

    wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
    tar -zxvf pcre2-10.30.tar.gz
    cd pcre2-10.30
    ./configure --prefix=/opt/pcre
    make && make installyum -y install pcre-devel

     3.安装apache

    ./configure --prefix=/opt/apache --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-include-apr --enable-so
    make && make install

    4.你会发现apache stop|restart|start都不成功

    Could not reliably determine the server's fully qualified domain name

    解决办法

    vi httpd.conf
    #ServerName www.example.com:80 
    #修改为
    ServerName localhost:80

    5.将apache设定为开机启动

    注册Apache到Linux服务
    在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现:

    /opt/apache/bin/apachectl start|stop|restart

    加入开机启动

    cp /opt/apache/bin/apachectl  /etc/rc.d/init.d/httpd 
    #链接文件的S61是启动时的序号。
    #当init.d目录下有httpd脚本后,我们就可以通过service命令来启动关闭apache了。
    ln -s /etc/rc.d/init.d/httpd  /etc/rc.d/rc3.d/S61httpd
    service httpd start | stop | restart

    这时有个问题就是:虽然apache已经可以自动启动,但在linux的服务列表中却看不到它,要添加服务,一般通过chkconfig --add xxx来实现,但需要脚本中有相应的信息才行,否则chkconfig就会提示:xxx 服务不支持 chkconfig。所以我们首先编辑httpd脚本,在第2行(#!/bin/sh下面)添加如下注释信息(包括#):

    vi /etc/rc.d/init.d/httpd
    # chkconfig: 35 61 61
    # description: Apache

    第一行的3个参数意义分别为:在哪些运行级别启动httpd(3,5);启动序号(S61);关闭序号(K61)。注意:第二行的描述必须要写!保存后执行:

    chkconfig --add httpd #所有开机模式下自启动,另外chkconfig httpd on 表示345模式下自启动
    

    就将httpd添加入服务了。在rc3.d、rc5.d路径中将来就会出现S61httpd的链接,其他运行级别路径中会出现K61httpd的链接。

    运行下面的命令查看服务,就可以看到httpd的服务了。

    chkconfig --list
    
  • 相关阅读:
    leetcode 763. Partition Labels
    JS字符串格式化~欢迎来搂~~
    手把手教你在pycharm上上传项目至GitHub
    手把手教你用原始方式上传项目至GitHub
    python3.7环境下创建app、运行Django1.11版本项目报错Generator expression must be parenthesized
    在学习python的DjangoFlaskTornado前你需要知道的,what is web?
    python手撸桌面计算器
    jQuery之克隆事件--clone()与clone(true)区别
    前端之jQuery基础
    通过案例来剖析JQuery与原生JS
  • 原文地址:https://www.cnblogs.com/adtuu/p/8284408.html
Copyright © 2011-2022 走看看