zoukankan      html  css  js  c++  java
  • Apache-2.4.x源码安装

    Apache-2.4.x源码安装

    官方网站:

    环境:

    centos7
    httpd-2.4

    一.安装编译依赖库
    yum -y install gcc gcc++ zlib zlib-devel

    二.卸载自带httpd
    for package in $(rpm -qa|grep httpd)
    do
        rpm -e --nodeps $package
    done

    三.安装
    1.apr
    tar -xvf apr-1.5.2.tar.bz2 -C /usr/local/src
    cd /usr/local/src/apr-1.5.2
    ./configure --prefix=/opt/apache/apr && make -j4 && make install

    2.apr-util
    tar -xvf apr-util-1.5.4.tar.bz2 -C /usr/local/src
    cd /usr/local/src/apr-util-1.5.4
    ./configure --prefix=/opt/apache/apr-util --with-apr=/opt/apache/apr && make -j4 && make install

    3.pcre
    tar -xvf pcre-8.37.tar.bz2 -C /usr/local/src
    cd /usr/local/src/pcre-8.37
    ./configure --prefix=/opt/apache/pcre && make -j4 && make install

    4.httpd
    tar -xvf httpd-2.4.17.tar.bz2 -C /usr/local/src
    cd /usr/local/src/httpd-2.4.17
    ./configure
    --prefix=/opt/apache/httpd
    --enable-rewrite
    --enable-so
    --enable-headers
    --enable-expires
    --enable-modules=most
    --enable-deflate
    --enable-rewrite=shared
    --enable-deflate=shared
    --enable-expires=shared
    --enable-static-support
    --with-mpm=worker
    --with-apr=/opt/apache/apr
    --with-apr-util=/opt/apache/apr-util
    --with-pcre=/opt/apache/pcre
    make -j4 && make install

    四.配置
    1.init脚本
    a.httpd
    cp /usr/local/src/httpd-2.4.17/build/rpm/httpd.init /etc/init.d/httpd
    chmod +x /etc/init.d/httpd
    sed -i "/httpd=/i HTTPD=/opt/apache/httpd/bin/httpd" /etc/init.d/httpd
    sed -i "/httpd=/i PIDFILE=/opt/apache/httpd/logs/httpd.pid" /etc/init.d/httpd
    sed -i "/CONFFILE=/ s#/etc/httpd#/opt/apache/httpd#g" /etc/init.d/httpd
    b.htcacheclean
    cp /usr/local/src/httpd-2.4.17/build/rpm/htcacheclean.init /etc/init.d/htcacheclean
    chmod +x /etc/init.d/htcacheclean
    sed -i "/htcacheclean=/i HTTPD=/opt/apache/httpd/bin/htcacheclean" /etc/init.d/htcacheclean
    sed -i "/htcacheclean=/i CACHEPATH=/opt/apache/httpd/cache-root" /etc/init.d/htcacheclean
    sed -i "/^pidfile=/c pidfile=/opt/apache/httpd/logs/${prog}.pid" /etc/init.d/htcacheclean
    mkdir -p /opt/apache/httpd/cache-root
    2.logrotate
    cp /usr/local/src/httpd-2.4.17/build/rpm/httpd.logrotate /etc/logrotate.d/
    sed -i "1c /opt/apache/httpd/logs/*.log {" /etc/logrotate.d/httpd.logrotate

    五.启服务
    chkconfig httpd on
    chkconfig htcacheclean on
    service httpd start
    service htcacheclean start


    补充:ubuntu14.04
    apt-get -y install build-essential make openssl libgnutls-openssl27 libssl-dev
    ./configure --prefix=/opt/apache --with-mpm=worker --enable-mods-shared=all --enable-so --enable-most --enable-max  --enable-rewrite=shared --enable-speling=shared --enable-deflate=shared  --enable-cache=shared --enable-file-cache=shared --enable-proxy=shared --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy-ajp=shared  --enable-proxy-balancer=shared --enable-ssl
    make -j2 && make install
    echo /opt/apache/lib >> /etc/ld.so.conf
    ldconfig
    cp /opt/apache/bin/apachectl /etc/init.d/httpd
    service httpd start
    update-rc.d httpd defaults
  • 相关阅读:
    串口基本知识
    20180826
    20180819
    自动化测试
    说话有重点 测试思维
    学习C语言,在软件测试中如何用?
    PC能替代服务器吗?
    服务器与普通电脑的区别?
    k8s 回滚应用
    k8s Service
  • 原文地址:https://www.cnblogs.com/lixuebin/p/10814325.html
Copyright © 2011-2022 走看看