VPS侦探论坛

 找回密码
 注册
查看: 4062|回复: 4

http2的疑问

[复制链接]
发表于 2016-7-8 22:34:42 | 显示全部楼层 |阅读模式

大家好!
以我的风格,在这个问题上已经做了搜索相关文章的事,在版本更新说明,1.3是默认支持http2的,我查看了我的版本是1.10 但是我的nginx就是不支持http2
贴出我的conf
  1. server {
  2.   listen 80;
  3.   server_name  www.boxmail.cn boxmail.cn;
  4.   rewrite ^ https://$server_name$request_uri? permanent;
  5. }

  6. server {
  7.     listen 443 ssl http2;
  8.     server_name www.boxmail.cn;
  9.     ssl on;
  10.     ssl_certificate /etc/ssl/server.crt;
  11.     ssl_certificate_key /etc/ssl/server.key;
  12.     ssl_prefer_server_ciphers on;
  13.         ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  14.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  15.         ssl_session_cache shared:SSL:10m;
  16.         
  17.     location / {
  18.         root /home/wwwroot/www.boxmail.cn;
  19.                 index index.html index.htm index.php default.html default.htm default.php;
  20.         include wordpress.conf;
  21.         #error_page   404   /404.html;
  22.         include enable-php.conf;
  23. location ~ /data/settings/settings.xml {
  24.     return 404;
  25. }
  26.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  27.         {
  28.             expires      30d;
  29.         }

  30.         location ~ .*\.(js|css)?$
  31.         {
  32.             expires      12h;
  33.         }

  34.         location ~ /\.
  35.         {
  36.             deny all;
  37.         }

  38.         access_log off;
  39.     }
  40. }
复制代码

  1. nginx version: nginx/1.10.0
  2. built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
  3. built with OpenSSL 1.0.1e-fips 11 Feb 2013
  4. TLS SNI support enabled
  5. configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module
复制代码

[ 本帖最后由 hsia 于 2016-7-8 22:47 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-7-8 23:36:14 | 显示全部楼层

回复 1# 的帖子



经查,TLS HTTP /2连接需要“应用层协议协商”(ALPN)TLS扩展支持,这仅因为OpenSSL的1.0.2版。使用“下一个协议谈判”(NPN)TLS扩展用于此目的(自OpenSSL的版本1.0.1)不能保证。

以上来自官方翻译。说明openssl的版本问题,我的版本太低。等升级openssl再看看。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-9 00:29:39 | 显示全部楼层

回复 2# 的帖子


问题来了,怎么样编译安装升级这个openssl 1.0.2h ???
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-7-9 08:00:34 | 显示全部楼层



在一些高版本的chrome 50或其他浏览器上是必须要求alpn才能支持到http2的

alpn的支持方法
编译时指定上 --with-openssl=openssl源码目录全路径
lnmp 1.3可以直接修改lnmp.conf 里的Nginx_Modules_Options='' ,引号中加上--with-openssl=openssl源码目录全路径 ,然后重新升级一下nginx就行

cd /root/
wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz
tar zxf openssl-1.0.2h.tar.gz
修改lnmp.conf 里的Nginx_Modules_Options='' 为 Nginx_Modules_Options='--with-openssl=/root/openssl-1.0.2h'
./upgrade.sh nginx
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-9 09:36:05 | 显示全部楼层

回复 4# 的帖子


感谢,现在支持了。非常感谢。

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-29 09:23 , Processed in 0.026837 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表