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
    
  • 默认页面
    在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值