简体   繁体   English

如何在nginx中禁用http2

[英]How to disable http2 in nginx

due to this Safari Issue with HTTP/2 and Form POSTS I wanted to disable serving one Webpage via HTTP/2. 由于这个 Safari问题与HTTP / 2和表格POSTS我想通过HTTP / 2禁用服务一个网页。 So I just removed the "http2" from the server_name directive in corresponding nginx server block. 所以我刚从相应的nginx服务器块中的server_name指令中删除了“http2”。

server {
  listen x.x.x.x:443 ssl;
  server_name xxxx;
  [...]
}

But after I restarted NginX and opened the website in various browsers the HTTP/2 Protocol is still used... What am I doing wrong? 但是在我重新启动NginX并在各种浏览器中打开网站后,仍然使用HTTP / 2协议......我做错了什么?

My NginX version is 1.10.1 我的NginX版本是1.10.1

Greets Jan 迎接Jan

Someone answered with the correct solution here, but the post disappeared... 有人在这里回答了正确的解决方案,但帖子消失了......

You have to disable http2 for all server blocks on one IP Adress / Port. 您必须为一个IP地址/端口上的所有服务器块禁用http2。 If there is one server block configured to enable http2 it is enabled for all server blocks on this IP. 如果有一个服务器块配置为启用http2,则会为此IP上的所有服务器块启用它。

NGINX can't serve multiple protocol on 1 port. NGINX无法在1端口上提供多种协议。 Make it different port . 使它成为不同的端口 Example : HTTP/2 on port 443 示例:端口443上的HTTP / 2

server {
  listen x.x.x.x:443 ssl http2;
  server_name xxxx;
  [...]
}

and then HTTP 1.1 on port 444 然后在端口444上使用HTTP 1.1

 server {
      listen x.x.x.x:444 ssl;
      server_name xxxx;
      [...]
    }

or if you wanna disable http/2 module, re-install NGINX without --with-http_v2_module 或者如果你想禁用http / 2模块,请重新安装NGINX而不使用--with-http_v2_module

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM