• 编译安装httpd-2.4


    首先要准备好环境,然后下载httpd-2.4.25.tar的包(http://httpd.apache.org)

    1:安装包组

    # yum groupinstall -y "Development tools" "Server Platform Development"

    2:安装依赖包

    # yum install -y pcre-devel apr-devel apr-util-devel openssl-devel

    3:解压本地的httpd-2.4.25.tar

    # tar xf httpd-2.4.25.tar

    # cd httpd-2.4.25

    4:配置安装信息,生成make file,yum安装的rpm包一般都是在/usr目录下

    # ./configure --prefix=/usr/local/apache-2.4 --sysconfdir=/etc/httpd-2.4 --enable-so --enable-ssl --enable-rewrite --enable-modules=most --enable-mpms-shared=all --with-zlib --with-pcre --with-apr=/usr --with-apr-util=/usr --with-mpm=prefork

    5:编译安装

    # make && make install

    6:制作链接,便于版本管控

    # ln -sv /usr/local/apache-2.4 /usr/local/apache

    7:因为自带的Apache服务控制脚本:Apachectl 脚本在/usr/local/apache-2.4/bin/目录下,可以将这个目录加到环境变量中,编辑vi /etc/profile.d/httpd.sh ,添加export PATA=/usr/local/apache/bin/:$PATH,那么启动的时候就可以直接使用apachectl start

    # vi /etc/profile.d/httpd.sh

    export PATA=/usr/local/apache/bin/:$PATH

    # ./etc/profile.d/httpd.sh

    8:将头文件和库文件输出到默认的

    # ln -sv /usr/apache/include /usr/include/httpd

    9:启动httpd-2.4

    # apachectl start 

    10:编写服务脚本实现 server httpd start 启动httpd(从这里开始一下都可可以不用写)

    # vi /etc/rc.d/init.d/functions

     

    #! /bin/bash
    #
    # network Bring up/down networking
    #
    # chkconfig: 2345 10 90
    # description: Activates/Deactivates all network interfaces configured to
    # start at boot time.
    #
    ### BEGIN INIT INFO
    # Provides: $network
    # Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager $network-pre
    # Short-Description: Bring up/down networking
    # Description: Bring up/down networking
    ### END INIT INFO

    # Source function library.

         . /etc/rc.d/init.d/functions

    if [ -f /etc/sysconfig/httpd ]; then
    . /etc/sysconfig/httpd
    fi

    HTTPD_LANG=${HTTPD_LANG-"C"}

    INITLOG_ARGS=""


    apachectl=/usr/local/apache/bin/apachectl
    httpd=${HTTPD-/usr/local/apache/bin/httpd}
    prog=httpd
    pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}
    lockfile=${LOCKFILE-/var/lock/subsys/httpd}
    RETVAL=0
    STOP_TIMEOUT=${STOP_TIMEOUT-10}

    start() {
    echo -n $"Starting $prog: "
    LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch ${lockfile}
    return $RETVAL
    }

    stop() {
    status -p ${pidfile} $httpd > /dev/null
    if [[ $? = 0 ]]; then
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
    else
    echo -n $"Stopping $prog: "
    success
    fi
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
    }

    reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
    RETVAL=6
    echo $"not reloading due to configuration syntax error"
    failure $"not reloading $httpd due to configuration syntax error"
    else
    # Force LSB behaviour from killproc
    LSB=1 killproc -p ${pidfile} $httpd -HUP
    RETVAL=$?
    if [ $RETVAL -eq 7 ]; then
    failure $"httpd shutdown"
    fi
    fi
    echo
    }

    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    status)
    status -p ${pidfile} $httpd
    RETVAL=$?
    ;;
    restart)
    stop
    start
    ;;
    condrestart|try-restart)
    if status -p ${pidfile} $httpd >&/dev/null; then
    stop
    start
    fi
    ;;
    force-reload|reload)
    reload
    ;;
    graceful|help|configtest|fullstatus)
    $apachectl $@
    RETVAL=$?
    ;;
    *)
    echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
    RETVAL=2
    esac

    exit $RETVAL

    11:让脚本可以被chkconfig管控

    # chkconfig --add /etc/rc.d/init.d/httpd-2.4

    12:使用service重启服务

    # service httpd-2.4 restart

    ##########################################

  • 相关阅读:
    ueditor PHP版本使用方法
    PHP三维优先级运算
    navicate for mysql中的sql存放位置和备份
    wamp配置步骤
    phpeclipse xdebug 配置配置 -摘自网络
    xls 和 xml 数据 排序 绑定 -原创
    XSLT教程 比较全的 -摘自网络
    XPath在asp.net中查询XML -摘自网络
    windows上zend server安装 报The server encountered an internal error or misconfiguration and was unable to complete your request -解决方法 摘自网络
    开源项目 配置管理软件推荐
  • 原文地址:https://www.cnblogs.com/ping-7/p/7912676.html
走看看 - 开发者的网上家园