由于官网目前能下载到的nginx-1.11.4不支持http2

D:\http2\nginx-1.11.4>nginx -s reload
nginx: [emerg] the "http2" parameter requires ngx_http_v2_module in D:\http2\nginx-1.11.4/conf/nginx.conf:98

原因是官方编译的时候没有带上--with-http_v2_module,因此需要重新编译nginx

要在windows下编译,太痛苦了吧,还是移师mac

重新编译nginx需要依赖以下模块:

1. 编译OpenSSL

http://www.openssl.org/source下载当前最新的版本源码

解压缩openssl-xx.tar.gz包, 进入解压缩目录,执行:

./config
make
sudo make install

2. 编译Nginx

http://www.pcre.org下载当前最新的版本的pcre源码

http://nginx.org/en/download.html下载当前最新的版本的nginx源码

解压缩pcre-xx.tar.gznginx-xx.tar.gz包,进入解压缩目录,执行:

./configure --with-pcre=/Users/enzo/http2/pcre-8.39 --with-http_v2_module --with-http_ssl_module
make
sudo make install

 

Ok,完成!