我的一个 WordPress 网站有很多静态图片(每页至少 20 张),启用 HTTP/2 后,下半部分的图片开始显示为损坏(被划掉,就像有死链接的图片一样)。error.log 文件中没有显示任何错误,但 Chrome 53 在控制台中显示如下内容:
Failed to load resource: net::ERR_SPDY_PROTOCOL_ERROR
我尝试过,client_max_body_size
但没有成功。
编辑:这是我的 nginx.conf:
load_module /usr/local/libexec/nginx/ngx_mail_module.so;
load_module /usr/local/libexec/nginx/ngx_stream_module.so;
user www;
worker_processes 4;
error_log /var/log/nginx/error.log info;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 0;
large_client_header_buffers 2 1k;
client_body_timeout 12;
send_timeout 10;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip off;
charset UTF-8;
server {
listen 80;
server_name manuth.life www.manuth.life;
server_tokens off;
return 301 https://$server_name$request_uri; #redirects to HTTPS
root /usr/local/www/nginx/manuth.life;
index index.php index.html index.htm;
access_log /var/log/nginx/manuth.life.access.log;
error_log /var/log/nginx/manuth.life.error.log;
error_page 500 502 503 504 /50x.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
server {
listen 443 ssl http2;
server_name manuth.life www.manuth.life;
server_tokens off;
root /usr/local/www/nginx/manuth.life;
index index.php index.html index.htm;
access_log /var/log/nginx/manuth.life.access.log;
error_log /var/log/nginx/manuth.life.error.log;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
# strict SSL settings
ssl_certificate /usr/local/etc/letsencrypt/live/manuth.life/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/manuth.life/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1; #
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /usr/local/etc/ssl/dhparam.pem;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 10s;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
}
答案1
这似乎是 Chrome 53 的问题。我正在使用 Chrome 54,不再看到此问题。事实上,速度飞快!(在本地网络上)