启用 HTTP2 的 Nginx 下载所有内容

sod*_*oss 8 nginx

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

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

虚拟主机配置:

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/";
    }

}
Run Code Online (Sandbox Code Playgroud)

如果我http2listen指令中删除,该站点将按预期 100% 工作并正常提供文件。

关于为什么会发生这种情况的任何见解?搜索 google 似乎只会产生有关正在下载的 .php 文件的结果(由错误配置的 php-fpm 引起)。

编辑:下载的文件总是有这个:

在 TextEdit 中打开时:

Ä???????
Run Code Online (Sandbox Code Playgroud)

在 Sublime Text 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
Run Code Online (Sandbox Code Playgroud)

Nat*_*ath 12

一般预计 http2 会在 ssl/tls 上运行,chrome 和 Firefox 都只支持加密的 http2。

将 http/2 添加到 ssl 时是否遇到相同的错误 ie listen 443 ssl http2