Apache2.4.43源码安装

Apache2.4.43源码安装

一、检查系统中是否安装过apache软件:
rpm -qa httpd
如果发现需要删除:
rpm -e httpd

二、预安装软件:
yum -y install gcc gcc++ zlib zlib-devel

三、下载apache安装相关的软件包:
APR 1.6.5
APR-UTIL 1.6.1
Pcre 8.00
Httpd-2.4.43

四、开始安装:
1.APR1.6.5安装

$tar -xzvf apr-1.6.5.tar.gz -C /usr/src
#解压到指定目录/usr/src下
$cd /usr/src/apr-1.6.5
$./configure --prefix=/usr/local/apr
$make&&make install

2.APR-util安装

$tar -xzvf apr-util-1.6.1.tar.gz -C /usr/src
#解压到指定目录/usr/src下
$cd /usr/src/apr-util-1.6.1
$./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
$make&&make install

3.Pcre安装

$tar -xzvf pcre-8.00.tar.gz -C /usr/src
#解压到指定目录/usr/src下
$cd /usr/src/pcre-8.00
$./configure --prefix=/usr/local/pcre
$make&&make install

4.Httpd安装

$tar -xzvf httpd-2.4.43.tar.gz -C /usr/src
#解压到指定目录/usr/src下
$cd /usr/src/httpd-2.4.43
$./configure \ 
--prefix=/usr/local/httpd \
--with-apr=/usr/local/apr  \
--with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre \
--enable-so \
--enable-rewrite \
--enable-ssl \
--enable-cgi \
--enable-module=most \
--enable-mods-shared=most \
--enable-mpms-shared=all \
--with-mpm=event \
--enable-cgid \
--enable-proxy \
--enable-proxy-fcgi \
--enable-expires \
--enable-deflate \

$make&&make install

5.启动apache服务

$cd /usr/local/httpd/bin
$./apachectl start

6.设置开机自启动服务控制脚本

   #apache start
   /usr/local/httpd/bin/apachectl start
   #apache stop
   /usr/local/httpd/bin/apachectl stop
   #让apache随系统启动自启动
   #echo "/usr/local/httpd/bin/apachectl start" >> #/etc/rc.local
   #把apache加入到系统服务
   #首先以apachectl脚本为模板生成apache服务控制脚本:
   cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd


   #编辑/etc/init.d/httpd,在文件第二行插入下面的行,使其支    持chkconfig命令:
   #!/bin/sh
   # chkconfig: 2345 85 15
   # description: Apache is a World Wide Web server.
...
  
 #为apache服务控制脚本添加执行权限:
   chmod +x /etc/init.d/httpd
   #将apache服务加入到系统服务:
   chkconfig httpd on
   #检查apache服务是否生效:
   chkconfig --list httpd
   如果命令输出如下结果则表明apache服务已经生效:
   httpd0:off 1:off 2:on 3:on 4:on 5:on 6:of

上面表明apache在2、3、4、5系统运行级别随系统启动而自启动。
以上如果全部成功后,可以用service命令控制apache的启动和停止。

   $systemctl start httpd
   $systemctl stop httpd
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值