[attachment=87653]
内容
apache 在这里:
在 Apache 上部署 HTTP/2
[attachment=87651][attachment=87652]
这里我们用 CHACHA20 的加密方式,所以这里我们将 openssl 替换为比较黑科技的分支 LibreSSL,LibreSSL 是在心血漏洞后由 OpenBSD 创建的分支比谷歌的 BoringSSL 使用难得要小一些。LibreSSL 还有一个方便的地方就是不需要我们去编译,nginx 自己会编译的。
准备
在
./configure 参数中加入
--with-openssl=/path/to/libressl-2.3.0 --with-http_v2_module --with-http_ssl_module
当然了,对新手来说还是太笼统了,所以我再详细介绍一下。
首先我们下载,LibreSSL:
cd /root
wget -c http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.3.0.tar.gz // 最好进入目录看看有没有更新的版本,有就下载更新的版本
tar xzf libressl-2.3.0.tar.gz // 如果有新的版本,这里也要改版本号
mv libressl-2.3.0 libressl //将目录重命名为 libressl,为了方便未来升级 nginx,如果 libressl 也有变动,那么就就只要在这个目录下,删除旧的上传新的。
接着,我们下载 nginx:
出这篇文章的时候,刚好出 1.9.6,所以我们就用 1.9.6 了,如果有新的,务必也下载新版本。
wget http://nginx.org/download/nginx-1.9.6.tar.gz
tar xzf nginx-1.9.6.tar.gz && cd nginx-1.9.6
编译
这是我原来的参数,
./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module
我们去掉 spdy,改为 h2,并且加入 libressl 参数:
./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-openssl=/root/libressl --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module
然后新安装的就安装,升级的就升级,不再累述。
然后耐心等待,nginx 会自动编译 libressl。
配置
现在我们要配置 h2 和 CHACHA20 的加密方式了。
在 443 端口的位置,去掉 spdy,加入 h2
listen 443 ssl http2 default_server;
注意,如果你以前设置过 spdy,请删除所有和 spdy 有关的参数!
ssl_ciphers 的最前面加入
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:
最后
最后么,还是那句老话,不要忘记重启 nginx,如果不会就直接重启系统。
来自:
https://www.vobe.io/396
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。