apache编译安装-含下载地址-含踩过的坑

1、安装编译环境

yum -y install wget make gcc gcc-c++ pcre openssl openssl-devel zlib unzip cmake ncurses-devel libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel curl-devel libtool libtool-ltdl libtool-ltdl-devel libevent libevent-devel zlib-static zlib-devel autoconf pcre-devel gd perl freetype freetype-devel expat-devel

2、安装apr

wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.5.tar.gz
tar xf apr-1.6.3.tar.gz
cd apr-1.6.3

vim configure
找到RM='$M' 修改为RM=‘$RM -f’

./configure --prefix=/usr/local/apr/
make
make install

3、安装 apr-util

wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install

4、编译安装apache

#创建运行apache的用户
groupadd www
useradd -g www www -s /bin/false
#下载软件
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
tar -zxvf httpd-2.4.29.tar.gz
cd httpd-2.4.29
#编译
./configure --prefix=/usr/local/httpd/
–sysconfdir=/etc/httpd/
–with-include-apr
–disable-userdir
–enable-headers
–with-mpm=worker
–enable-modules=most
–enable-so
–enable-deflate
–enable-defate=shared
–enable-expires-shared
–enable-rewrite=shared
–enable-static-support
–with-apr=/usr/local/apr/
–with-apr-util=/usr/local/apr-util/bin
–with-ssl
–with-z

make
make install

哎呀我天这就过不去了、、、、、
在这里插入图片描述

报错解决办法

https://blog.51cto.com/castiel/2051440

yum install gcc gcc-c++ prce-devel expat-devel
yum install -y libxml2-devel
[root@localhost ~]# rm -rf /usr/local/apr-util
[root@localhost ~]# cd /usr/local/src/apr-util-1.6.1

必须清除之前配置时的缓存

[root@localhost apr-util-1.6.1]# make clean

源码安装三步走

[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make
[root@localhost apr-util-1.6.1]# make install

继续编译apache

./configure --prefix=/usr/local/httpd/
–sysconfdir=/etc/httpd/
–with-include-apr
–disable-userdir
–enable-headers
–with-mpm=worker
–enable-modules=most
–enable-so
–enable-deflate
–enable-defate=shared
–enable-expires-shared
–enable-rewrite=shared
–enable-static-support
–with-apr=/usr/local/apr/
–with-apr-util=/usr/local/apr-util/bin
–with-ssl
–with-z
在这里插入图片描述
呵呵、、过去了。。。。
make && make install
在这里插入图片描述

修改apache配置(/etc/httpd/httpd.conf)

vim /etc/httpd/httpd.conf
在这里插入图片描述

增加apache环境变量

在这里插入图片描述
cat >> /etc/profile << END
export PATH=$PATH:/usr/local/httpd/bin/
END
source /etc/profile

设置启动项服务

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
修改你的vim /etc/init.d/httpd脚本 在开始处#!/bin/bash之后的行后插入

增加服务

chkconfig --add httpd
chkconfig --level 2345 httpd on

启动|停止|重启apache方式

启动|停止|重启 /etc/init.d/httpd start|stop|restart

#扩展
启动 /usr/local/httpd/bin/apachectl -f /etc/httpd/httpd.conf
暴力停止 /usr/local/httpd/bin/apachectl -k stop
优雅停止 /usr/local/httpd/bin/apachectl -k graceful-stop
优雅的重启 /usr/local/httpd/bin/apachectl -k graceful
暴力重启 /usr/local/httpd/bin/apachectl -k restart

启动报错
需要修改httpd.com里面的servername字段
servername localhost:80
然后重启即可
在这里插入图片描述
/etc/init.d/httpd restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值