编译安装httpd 2.4

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编译安装httpd 2.4相关的知识,希望对你有一定的参考价值。

CentOS 6.9

(1)关闭SELINUX

Note:如果不关闭SELINUX,在设置DocumentRoot的时候可能会出现Forbidden等各种不可预知的问题

#sed  -i ‘s/^SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config`

(2)关闭IPTABLES和添加系统用户

也可以打开80端口,这里为了测试方便就直接关闭

# /etc/init.d/iptables stop
# groupadd -r apache
# useradd -r -g apache apache

(3)需要的依赖包

# yum -y groupinstall "Development tools" "Server Platform Development"
# yum -y install pcre-devel
# yum -y install expat-devel

(4)下载安装包

wget https://mirrors.aliyun.com/apache/httpd/httpd-2.4.29.tar.gz https://mirrors.aliyun.com/apache/apr/apr-1.6.3.tar.gz https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz

(5)安装apr

# tar xf apr-1.6.3.tar.gz
# apr-1.6.3
# ./configure --prefix=/usr/local/apr
# make && make install

(6)安装apr-util

# tar xf 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

(7)安装httpd

# tar xf httpd-2.4.29.tar.gz 
# cd httpd-2.4.29
# ./configure --prefix=/usr/local/apache --sysconf=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mem=event --libdir=/usr/lib64

(8)添加环境变量

# echo "PATH=/usr/local/apache/bin/apachectl:$PATH" > /etc/profile.d/httpd.sh

(9)启动http服务

# apachectl -k start

(10)查看监听端口

ss -tnl

以上是关于编译安装httpd 2.4的主要内容,如果未能解决你的问题,请参考以下文章

apache-httpd2.4编译安装

编译安装httpd 2.4

编译安装httpd-2.4

centos6 编译安装httpd-2.4

centos 6 编译安装httpd-2.4

entos6 编译安装httpd-2.4方法一