美文网首页
Apache2.4编译安装

Apache2.4编译安装

作者: LL1502 | 来源:发表于2017-12-04 16:29 被阅读0次

    #编译安装Apache2.4#

    #httpd依赖于apr-1.4+, apr-util-1.4+, [apr-icon]#

    #准备工作

    安装开发环境,安装pcre-devel expat-devel openssl-devel

    [#注意#]

    使用了 apr 1.6.2 的依赖,所以下面我们必须要用 apr-util 1.6.0 版本,apr-util 1.6.0不再捆绑安装 expat ,但又需要 expat 的支持,所以我们得手动先安装 expat。不然编译 apache 的时候会报错。

    1)编译安装 expat

    wget https://sourceforge.net/projects/expat/files/expat/2.2.3/expat-2.2.3.tar.bz2

    # tar jxf expat-2.2.3.tar.bz2

    # cd expat-2.2.3/

    # ./configure --prefix=/usr/local/expat

    # make && make install

    2)编译apr-util-1.6.1

    #./configure \

    --prefix=/usr/local/apr-util \

    --with-apr=/usr/local/apr \

    --with-expat=/usr/local/expat

    # make && make install

    [#注意#]

    (1) apr 下载地址:https://mirrors.aliyun.com/apache/apr/apr-1.6.3.tar.gz

    # ./configure --prefix=/usr/local/apr

    # make && make install

    (2) apr-util 下载地址:https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz

    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

    # make && make install

    #Httpd2.4编译安装#

    1)创建用户

    #useradd www -M -s /sbin/nologin

    2)解压

    #tar zxvf httpd-2.4.29.tar.gz

    #cd ./httpd-2.4.29

    3)配置

    #./configure \

    --prefix=/apps/apache \

    --sysconfdir=/etc/httpd24 \

    --enable-so \

    --enable-ssl \

    --enable-cgi \

    --enable-rewrite \

    --with-zlib \

    --with-pcre \

    --with-apr=/usr/local/apr \

    --with-apr-util=/usr/local/apr-util/ \

    --enable-mpms-shared=all \

    --with-mpm=event \

    --enable-modules=most

    4)编译及安装

    # make && make install

    [安装完之后的事]

    1)打开ServerName

    #vim /etc/httpd24/httpd.conf

    #ServerName localhost:80

    2)开放防火墙80端口

    #vim /etc/sysconfig/iptables

    #添加 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

    3)添加到环境变量

    #echo "PATH=/apps/apache/bin:\$PATH" > /etc/profile.d/httpd.sh

    #source /etc/profile

    相关文章

      网友评论

          本文标题:Apache2.4编译安装

          本文链接:https://www.haomeiwen.com/subject/bcpjmxtx.html