Ubuntu16.04LTSでhttp2に対応させる

やっとhttp2化出来る。。。
(パッケージからやりたかったのw)

その前にまずはnginxをhttpsに対応させましょう
NginxでLet’s Encrypt

さてUbuntu 16.04LTSのnginxバージョンは

# nginx -v
nginx version: nginx/1.9.15 (Ubuntu)

ということでhttp2対応してるバージョンが入るようです。

もう少し詳しく見てみます。

# apt-cache show nginx
Package: nginx
Priority: optional
Section: web
Installed-Size: 36
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Kartik Mistry <kartik@debian.org>
Architecture: all
Version: 1.9.15-0ubuntu1
Depends: nginx-core (>= 1.9.15-0ubuntu1) | nginx-full (>= 1.9.15-0ubuntu1) | nginx-light (>= 1.9.15-0ubuntu1) | nginx-extras (>= 1.9.15-0ubuntu1), nginx-core (<< 1.9.15-0ubuntu1.1~) | nginx-full (<< 1.9.15-0ubuntu1.1~) | nginx-light (<< 1.9.15-0ubuntu1.1~) | nginx-extras (<< 1.9.15-0ubuntu1.1~)
Filename: pool/main/n/nginx/nginx_1.9.15-0ubuntu1_all.deb
Size: 3490
MD5sum: 38ab3abe6bb3c8b1ce3917596225b972
SHA1: 7ca9e1d118f0f19502fa82017aefae328d413daf
SHA256: d170567295cbe4d6741775ae3993f9fa37c070884f13e84a523130e779006a05
Description-en: small, powerful, scalable web/proxy server
 Nginx ("engine X") is a high-performance web and reverse proxy server
 created by Igor Sysoev. It can be used both as a standalone web server
 and as a proxy to reduce the load on back-end HTTP or mail servers.
 .
 This is a dependency package to install either nginx-core (by default),
 nginx-full, nginx-light, or nginx-extras.
Description-md5: 2d277b9313aa50e3bfd675e64b49532c
Homepage: http://nginx.net
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
#

ということで、

モジュール

# nginx -V
nginx version: nginx/1.9.15 (Ubuntu)
built with OpenSSL 1.0.2g-fips  1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

–with-http_v2_module
ほうほう。どうやら対応しているみたいなので、
早速やってみる。

後ろに 「http2」を書くだけ。

server {
        listen 443 ssl  http2;

これだけ。。。

確認は、Chromeの機能拡張
HTTP/2 and SPDY indicator
を追加。

アクセスして稲妻が青になればOK!!

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Enter code * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.