我在能够执行 HTTP/2.0 的后端网络服务器前使用 nginx 作为反向 ssl 代理。
我注意到 nginx 通过 HTTP/1.1 而不是 HTTP/2.0 代理对后端服务器的请求。是否可以告诉 nginx 使用未加密的 HTTP/2.0 连接?这会提高性能吗?
我最近将 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; …
Run Code Online (Sandbox Code Playgroud)