刚才装了一下Drupal 10 发现这一个问题,上传文章缩略图或用户头像,总会出现这个问题,google找了很久,才找到这个解决方案,不敢独享,放这里大家一起用。
1- 添加到Nginx的伪静态设置里:
location @rewrite {
<span class="hljs-comment"># Some modules enforce no slash (/) at the end of the URL</span>
<span class="hljs-comment"># Else this rewrite block wouldn't be needed (GlobalRedirect)</span>
rewrite ^ <span class="hljs-regexp">/index.php;
}
location ~ ^/si</span>tes/.*<span class="hljs-regexp">/files/s</span>tyles/ {
try_files $uri @rewrite;
}
2- 在设置文件里复制进入这一行settings.php:
<span class="hljs-variable">$conf</span>[<span class="hljs-string">'image_allow_insecure_derivatives'</span>] = <span class="hljs-literal">TRUE</span>;
3- 重启nginx.