我怎样才能阻止 nginx 服务 http/2?
How can I prevent nginx from serving http/2?
我正在为我公司制作的电子商务网站实施 http/2。我将它托管在 debian jessie 上,发现现在可以很容易地从针对 openssl 1.0.2 构建的 backports 存储库中获取 nginx 以支持 ALPN(如今与 chrome 一起工作是必需的)。
所以我升级了我的libssl,然后升级了我的nginx。令我非常惊讶的是,nginx 现在似乎通过 http2 提供我的内容,即使我没有将该关键字添加到配置中。 Chrome 的开发工具在网络选项卡的 protocol
列中显示 h2
。
通常我会很高兴,但我想在 http1.1 和 http2 之间做一些比较测量。我怎样才能强制它再次(暂时)为 http1.1 服务以进行测量?
编辑:添加 nginx -V
的输出以具体说明我的版本
$ nginx -V
nginx version: nginx/1.9.10
built with OpenSSL 1.0.2h 3 May 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-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 --add-module=/build/nginx-1.9.10/debian/modules/nginx-auth-pam --add-module=/build/nginx-1.9.10/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-1.9.10/debian/modules/nginx-echo --add-module=/build/nginx-1.9.10/debian/modules/nginx-upstream-fair --add-module=/build/nginx-1.9.10/debian/modules/ngx_http_substitutions_filter_module
The http2 parameter (1.9.5) configures the port to accept HTTP/2 connections.
因此,在此端口上配置的任何虚拟服务器都将接受 HTTP/2 个连接。如果你想配置一些主机 HTTP/2 而其他主机没有,那么你必须使用不同的 IP 或端口。
我正在为我公司制作的电子商务网站实施 http/2。我将它托管在 debian jessie 上,发现现在可以很容易地从针对 openssl 1.0.2 构建的 backports 存储库中获取 nginx 以支持 ALPN(如今与 chrome 一起工作是必需的)。
所以我升级了我的libssl,然后升级了我的nginx。令我非常惊讶的是,nginx 现在似乎通过 http2 提供我的内容,即使我没有将该关键字添加到配置中。 Chrome 的开发工具在网络选项卡的 protocol
列中显示 h2
。
通常我会很高兴,但我想在 http1.1 和 http2 之间做一些比较测量。我怎样才能强制它再次(暂时)为 http1.1 服务以进行测量?
编辑:添加 nginx -V
的输出以具体说明我的版本
$ nginx -V
nginx version: nginx/1.9.10
built with OpenSSL 1.0.2h 3 May 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-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 --add-module=/build/nginx-1.9.10/debian/modules/nginx-auth-pam --add-module=/build/nginx-1.9.10/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-1.9.10/debian/modules/nginx-echo --add-module=/build/nginx-1.9.10/debian/modules/nginx-upstream-fair --add-module=/build/nginx-1.9.10/debian/modules/ngx_http_substitutions_filter_module
The http2 parameter (1.9.5) configures the port to accept HTTP/2 connections.
因此,在此端口上配置的任何虚拟服务器都将接受 HTTP/2 个连接。如果你想配置一些主机 HTTP/2 而其他主机没有,那么你必须使用不同的 IP 或端口。