Nginx 的 HTTP2 谁配置成功了?

2015-10-14 21:00:15 +08:00
 Andy1999
编译 Nginx1.9.5 加入了 http_v2_module
openssl 升级到了 1.0.2
listen 443 ssl http2 依然无效
请问有人成功过吗?求教程啊
5461 次点击
所在节点    NGINX
6 条回复
yeyeye
2015-10-14 22:39:56 +08:00
帮你谷歌了下,小弟的建议是一字不差的抄过去,看了几个都是一样的配置方法,只能建议您把 nginx 的支持功能列表查看一下(小弟记得可以查看编译了多少包进去,就知道支持啥功能了)
server {
listen 443 ssl http2 default_server;
ssl_certificate server.crt;
ssl_certificate_key server.key;
...
}

来源
http://www.cnbeta.com/articles/434667.htm
https://imququ.com/post/nginx-http2-patch.html
https://winclient.cn/nginx-1-9-5-release-support-http2/

免责条款
小弟是菜鸟,表打我,表 bLoCk 我,最好是忽视我的存在
tms
2015-10-14 23:35:06 +08:00
https://tms.im/tms/nginx-http2
推广自己 blog 的好时候
Andy1999
2015-10-14 23:40:13 +08:00
@yeyeye
@tms [root@localhost ~]# nginx -V
nginx version: nginx/1.9.5
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
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

Last login: Mon Oct 12 22:15:54 2015 from 125.227.87.232
[root@localhost ~]# nginx -V
nginx version: nginx/1.9.5
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
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
[root@localhost ~]# cat /usr/local/nginx/conf/vhost/dl.andy1999.com.conf
server
{
listen 80;
#listen [::]:80;
server_name dl.andy1999.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/dl.andy1999.com;
include other.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

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

access_log /home/wwwlogs/dl.andy1999.com.log access;
}
server {
listen 443 ssl http2;
server_name dl.andy1999.com ;
ssl on;
ssl_certificate /usr/local/nginx/conf/vhost/andy1999.com.crt;
ssl_certificate_key /usr/local/nginx/conf/vhost/andy1999.com.key;

ssl_dhparam /usr/local/nginx/conf/vhost/dhparam.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_stapling on;
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
ssl_prefer_server_ciphers on;

add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/dl.andy1999.com;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

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

access_log /home/wwwlogs/dl.andy1999.com.log access;
Andy1999
2015-10-14 23:40:50 +08:00
然而并无卵用 日了妹了
udumbara
2015-10-15 02:44:59 +08:00
Joming
301 天前
不喜欢折腾了,直接套个 CDN 解决。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/228076

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX