directadmin环境安装支持http2

测试环境:centos 6 64bits / php 7.2 / mysql 5.6 / openssl 1.0.1e

注意:不要在 CentOS 7.4,Debian 9,FreeBSD 11 上执行以下操作。如果您的OpenSSL已经支持ALPN扩展,CustomBuild将默认在您的操作系统上启用它!

1: 安装OpenSSL 1.0.2,并支持ALPN:

wget ftp://ftp.openssl.org/source/openssl-1.0.2q.tar.gz
tar xzf openssl-1.0.2q.tar.gz
cd openssl-1.0.2q
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install

2:安装nghttp2:

cd /usr/local/directadmin/custombuild
./build update
./build nghttp2

3:在apache中启用http2:

cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp -p configure/ap2/configure.apache custom/ap2/configure.apache

4:编辑文件 custom/ap2/configure.apache,找到以下代码

    "--with-ssl=/usr" \

替换为

    "--enable-http2" \
    "--enable-ssl-staticlib-deps" \
    "--with-ssl=/usr/local/lib_http2" \

5:重新安装apache:

./build apache

6:设置apache启用http2:

echo 'ProtocolsHonorOrder On' >> /etc/httpd/conf/extra/httpd-includes.conf
echo 'Protocols h2 h2c http/1.1' >> /etc/httpd/conf/extra/httpd-includes.conf

7:更新/etc/httpd/conf/extra/httpd-ssl.conf文件中的SSL Ciphers

cd /usr/local/directadmin/custombuild
./build rewrite_confs

8:修改php的运行方式为 php-fpm 才能支持

cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.2
./build set php2_release no
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build set mod_ruid2 no
./build php n
./build rewrite_confs
点赞