Nginx HTTP2 Configuration

Source: Internet
Author: User
Tags log log http 2 ssl certificate
HTTP 2.0 is the Hypertext Transfer Protocol 2.0, which is the next generation HTTP protocol. was developed by the hypertext Transfer Protocol Bis (httpbis) Working Group of the Internet Engineering Task Force (IETF). Is the first update since the release of http1.1 in 1999.
The HTTP/2 agreement evolved from SPDY, SPDY has fulfilled its mission and will soon be out of the historical arena (for example, Chrome will end its support for SPDY in early 2016 ";nginx, Apache has fully supported HTTP/2, and no longer supports SPDY).

General people put HTTP2 abbreviated as H2, although some friends may not be willing, but this abbreviation has been default, especially reflected in the browser to HTTP2 is this shorthand.

One: Installation of Nginx

HTTP2 requires SSL support and requires the following packages

Nginx-1.9.12.tar.gz
Openssl-1.0.1s.tar.gz
Pcre-8.38.zip
Zlib-1.2.8.tar.gz

The default compiled Nginx does not contain the HTTP2 module. So when compiling nginx, at least need to enable the Http_v2_module and Http_ssl_module two modules

./configure--prefix=/usr/local/nginx--with-zlib=/tmp/2/zlib-1.2.8--with-pcre=/tmp/2/pcre-8.38--with-http_v2_ Module--with-http_ssl_module  --with-openssl=/tmp/2/openssl-1.0.1s

Note that the source package path for Openssl,pcre,zlib is specified, not the path after installation

And then

Make

Make install

Two: Create an SSL certificate using OpenSSL

Reference: http://blog.csdn.net/mn960mn/article/details/42374597

Three: Nginx configuration

server {        Listen       443 SSL http2;        server_name  http2.yuni.com;        Ssl_certificate      /usr/local/nginx/ssl/server.crt;        Ssl_certificate_key  /usr/local/nginx/ssl/server.key;        Ssl_session_cache    shared:ssl:1m;        Ssl_session_timeout  5m;        Ssl_ciphers  high:!anull:! MD5;        Ssl_prefer_server_ciphers off;         Location/{            root   html;            Index  index.html index.htm;        }}

Save exit, and then start Nginx

Four: Testing

Best to use the latest version of Chrome, Firefox browser, I use Chrome v49

Configure http2.yuni.com to the Nginx IP address in the local hosts

Then, visit https://http2.yuni.com Note that you must use HTTPS

View Nginx's Access.log log


The above describes the Nginx HTTP2 configuration, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.