yum install zlib-devel    #error: mod_deflate 
yum install openssl-devel    #error: mod_ssl

1.安装前期编译准备

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

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

cd ..
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

cd ..
wget https://ftp.pcre.org/pub/pcre/pcre-8.33.tar.gz
tar -zxvf pcre-8.33.tar.gz
cd pcre-8.33
./configure --prefix=/usr/local/pcre
make && make install

下载Apache2.4.33

wget http://www.apache.org/dist/httpd/httpd-2.4.33.tar.gz
tar -zxvf httpd-2.4.33.tar.gz
cd httpd-2.4.33
 ./configure --prefix=/usr/local/apache --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/ --enable-ssl --enable-deflate --enable-expires --with-mpm=event 
make && make install

cd ..
yum -y install epel-release   #安装源文件支持包
yum install libnghttp2-devel   #安装mod_http2模块

cd httpd-2.4.33
./configure --enable-http2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/
./configure --with-nghttp2=/var/www/html  --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/
./configure  --enable-nghttp2-staticlib-deps --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/
make && make install 

编译OpenSSL

wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar -xzf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config --prefix=/usr/local/openssl
./config -t
make && make install