Nginx与HTTP2启用下载一切

我最近把nginx更新到了1.9.7,它支持http2。

当在我的一个虚拟主机中启用http2时,每一个nginx应该从那个虚拟主机提供的页面被下载。 我在最新版本的Chrome,Safari和Chrome for Android上进行了testing。 所有下载和保存导航到的页面名称都有相同的结果,即使页面实际上并不存在于服务器上。 保存在计算机上的页面从不包含服务器上的实际内容。 这是一个奇怪的文件,包含相同的,奇怪的1kbstring)。 我试着testing不同的扩展名,以确保它不是一个php-fpm,下载的每个扩展的问题。

虚拟主机configuration:

server { listen <ip>:80 http2; server_name testsite.dev; index index.php index.html index.htm; root /home/sites/test/www; access_log /var/log/nginx/sites/testsite-access_log; error_log /var/log/nginx/sites/testsite-error_log; # location / { # try_files $uri $uri/ /index.php; # } location = /favicon.ico { access_log off; log_not_found off; } gzip off; location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php-fpm/testsite.socket; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param open_basedir "/home/sites:/tmp:/usr/share/pear:/var/lib/php/session/"; } } 

如果我从listen指令中删除了http2 ,那么该网站按预期工作100%并正常提供文件。

任何有关为什么发生这种情况的见解 search谷歌似乎只会得到有关正在下载的.php文件的结果(由错误configuration的php-fpm引起的)。

编辑:获取下载的文件总是有这样的:

在TextEdit中打开时:

 ġˇˇˇˇˇˇ 

当在崇高文本3中打开时:

 0000 1204 0000 0000 0000 0300 0000 8000 047f ffff ff00 0500 ffff ff00 0004 0800 0000 0000 7fff 0000 0000 0807 0000 0000 0000 0000 0000 0000 01 

一般来说http2有望运行在ssl / tls上,而chrome和Firefox都只支持encryption的http2。

添加http / 2到ssl时listen 443 ssl http2你有同样的错误listen 443 ssl http2