CentOS7下Apache启用HTTP/2.0(mod_http2)
已安装apache版本是2.4.23,在2.4.17+开始支持http2了,所以版本符合要求。
httpd中没有mod_http2这个模块,所以需要重新编译一下apache
- 接下来查看现有apache编译参数
1 |
> cat /usr/local/apache/build/config.nice |
记录下来,留用。
- 找到httpd的源代码文件,没有的话从apache上wget下载然后解压。
进入httpd-2.4.23目录之后运行
1 2 3 4 5 |
> ./configure --prefix=/usr/local/apache \ --sysconfdir=/etc/httpd \ --enable-http2 \ 这一段内容参考上个步骤中记录的config内容,记得加上--enable-http2,这里我根据自己需要指定了httpd.conf的位置 |
接下来编译安装
1 2 3 |
> make > make install |
下面是无关紧要的信息
1 |
./configure --prefix=/usr/local/apache/ --sysconfdir=/usr/local/apache/conf/ --enable-headers --enable-deflate --enable-mine-magic --enable-so --enable-rewrite --enable-ssl --enable-expires --enable-static-support --enable-suexec --enable-http2 --with-include-apr --with-mpm=worker --disable-userdir |