【发布时间】:2018-09-06 22:08:42
【问题描述】:
我在我的虚拟机上安装了带有 wordpress 站点和 openssl 的 nginx 1.13.10。我正在尝试测试 http2 推送。这是我的 nginx 配置文件:
pastebin.com/71ziXeRh
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 192.168.133.21;
return 302 https://$server_name$request_uri;
}
# Load configuration files for the default server block.
server {
listen 443 ssl http2;
server_name 192.168.133.21;
include conf.d/self-signed.conf; #ssl config
ssl on;
location / {
root /var/www/wordpress/current;
index index.php index.html index.htm;
http2_push /wp-content/themes/twentyseventeen/assets/images/header.jpg;
http2_push /wp-content/themes/twentyseventeen/style.css?ver=4.7.4;
}
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /var/www/wordpress/current;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
重启nginx,没有报错。但是当我用 Chrome 调试它时,没有资源被推送demo image
如果我在某处做错了什么,请告诉我。
【问题讨论】:
-
你能把那个文件的相关内容也粘贴到这里吗?
-
这是 http2 推送部分位置 / { root /var/www/wordpress/current;索引 index.php index.html index.htm; http2_push /wp-content/themes/twentyseventeen/assets/images/header.jpg; http2_push /wp-content/themes/twentyseventeen/style.css?ver=4.7.4; }
-
您能否编辑您的问题并添加此部分?如果您没有权限,请告诉我,我会添加它。
-
请在此处添加编辑问题并添加详细信息
-
我编辑了我的问题的朋友