编译安装 httpd

编译安装 httpd

一、 环境要求

​ 需要 安装依赖apr 和apr-utils ,这2个包是apache解决跨平台开发所依赖的通用包

使用的版本:

apr-1.7.0.tar.bz2
apr-util-1.6.1.tar.bz2
httpd-2.4.39.tar.bz2

二、具体过程

  1. mkdir /apps

  2. 上传压缩文件到/apps 目录下

  3. 解压文件

    cd /apps

    cd /apps
    tar xvf apr-1.7.0.tar.bz2 
    tar xvf apr-util-1.6.1.tar.bz2 
    tar xvf httpd-2.4.39.tar.bz2 
    mv  apr-1.7.0/*  httpd-2.4.39/srclib/apr
    mv apr-util-1.6.1/*  httpd-2.4.39/srclib/apr-util
    
  4. 安装相关包

    yum install gcc prce-devel openssl-devel expat-devel -y
    
  5. 编译安装

    cd httpd-2.4.39/
    
    ./configure \
    --prefix=/apps/httpd24 \
    --enable-so \
    --enable-ssl \
    --enable-cgi \
    --enable-rewrite \
    --with-zlib \
    --with-pcre \
    --with-included-apr \
    --enable-modules=most \
    --enable-mpms-shared=all \
    --with-mpm=prefork
    
    make -j 4 && make install
    
  6. 设置启动用户和启动的快捷方式

    echo 'PATH=/apps/httpd24/bin:$PATH' > /etc/profile.d/httpd24.sh
    . /etc/profile.d/httpd24.sh
    useradd -s /sbin/nologin  -r apache
    
    vim /apps/httpd24/conf/httpd.conf 
    User apache
    Group apache                                                                           
    

    启动

    apachectl sart 
    

    访问首页验证

    看到 It works! 即可

发布了62 篇原创文章 · 获赞 7 · 访问量 1266

猜你喜欢

转载自blog.csdn.net/qq_36801585/article/details/104452296