使用http2.0

create on in resolved_bug with 0 comment and 187 view

记录下升级http2.0的过程

升级的前提:

  • 已经支持https

升级openssl

因为http2.0只支持openssl 1.02*以上版本,若低于它,则需要升级

  1. 下载openssl
sudo wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
  1. 解压, 编译安装
tar -xzvf openssl-1.0.2r.tar.gz cd openssl-1.0.2r sudo ./config make install
  1. 替换旧版本
# 安装路径为 /usr/local/ssl/ mv /usr/bin/openssl /usr/bin/openssl.OFF mv /usr/include/openssl /usr/include/openssl.OFF ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/bin/openssl /usr/local/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl
  1. 检查版本
openssl version > OpenSSL 1.0.2r 26 jan 2019

升级nginx

nginx 1.10以上版本才支持http2.

  1. 下载
http://nginx.org/download/nginx-1.12.2.tar.gz
  1. 解压
tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2
  1. 编译,安装
# 配置 (注: prefix代表nginx要安装的位置, --with-openssl指向openssl源码目录) ./configure --prefix=/usr/local/webserver/nginx-1.12.2 --with-http_ssl_module --with-http_v2_module --with-openssl=/root/openssl-1.0.2r make make install
  1. 检查 nginx 版本
nginx -V nginx version: nginx/1.12.2 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) built with OpenSSL 1.0.2r 26 jan 2019 TLS SNI support enabled configure arguments: --prefix=/usr/local/webserver/nginx-1.12.2 --with-http_ssl_module --with-http_v2_module --with-openssl=/root/openssl-1.0.2r/

配置nginx.conf

server { listen 443 ssl http2 default_server; ssl_certificate server.crt; ssl_certificate_key server.key; … }

end…

😁😂😃😄😅😆😇😈😉😐😑😒😓😔😕😖😗😘😙😠😡😢😣😤😥😦😧😨😩😰😱😲😳😴😵😶😷😸😹🙀🙁🙂🙃🙄🙅🙆🙇🙈
🙂