您的位置:首页 > 理论基础 > 计算机网络

编译安装httpd 2.4

2018-01-24 16:18 399 查看
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[/code] (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 'export PATH=/usr/local/apache/bin/apachectl:$PATH' > /etc/profile.d/httpd.sh

(9)启动http服务

# apachectl -k start

(10)查看监听端口

ss -tnl
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  apache http 编译安装