Apache-Centos7.6安装2.2.7

  • 查看系统是否存在软件

     rpm -qa httpd
    
  • 卸载系统自带的apache

    rpm -e 上步查出来的包名
    
  • 安装编译环境

    yum -y install gcc gcc-c++ make
    
  • 解压

    tar zxvf httpd-2.2.27.tar.gz 
    cd httpd-2.2.27
    
  • 编译

    ./configure \
    --prefix=/application/apache2.2.27 \
    --enable-deflate    \
    --enable-expires    \
    --enable-headers     \
    --enable-modules=most   \
    --enable-so    \
    --with-mpm=worker  \
    --enable-rewrite
    

    enable-deflate:压缩
    enable-expires:过期
    enable-headers:http头部
    enable-modules=most:激活大多数模块
    enable-so:
    with-mpm=worker:worker模式
    enable-rewrite:激活地址重写功能

    错误:

    错误1:
    checking for zlib location… not found
    checking whether to enable mod_deflate… configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
    解决方法: yum install zlib zlib-devel -y

  • 安装

    make
    make install
    
  • 软链接

     ln -s /application/apache2.2.27/ /application/apache
    
  • 启动

    /application/apache/bin/apachectl start	
    

    实际是用下面的方法启动:

    /application/apache/bin/httpd -k start
    

    查看是否启动正常:

     lsof -i :80    
     ps -ef|grep httpd
    
  • apachectl 参数
    查看帮助

    /application/apache/bin/apachectl
    

    查看编译模块

    /application/apache/bin/apachectl -l
    

    检查语法

    /application/apache/bin/apachectl -t
    
  • 默认页面
    Apache-Centos7.6安装2.2.7_第1张图片

你可能感兴趣的:(Apache)