需要Nginx Expert(Wordpress插件问题)

我正在nginx上运行一个wordpress网站,除了我的一个插件= Adaptive Images for WordPress之外,其他所有功能都像魅力一样。 (此插件提供缩放后的图像)。

此插件的所有者说,请将其添加到位置,但不起作用。

location / {
rewrite \.(?:jpe?g|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php;
}

也尝试过这种方法:

location ~ /wp-content/(themes|uploads) {
     rewrite \.(?:jpe?g|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php;
}

这:

location ~ /wp-content/(themes|uploads) {
rewrite \.(?:jpe?g|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php;

}

什么都没做!

这是我的Nginx配置:https://github.com/stonedb00/stonedb/blob/master/nginxconf

所以我需要一个nginx专家给我正确的重写配置并解决它!

预先感谢

qazwsxedc89 回答:需要Nginx Expert(Wordpress插件问题)

您的错误是您的所有图像请求均由nginx使用此location块处理:

location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
    expires               60d;
    log_not_found         off;
}

由于要使用该插件处理所有图像请求,请尝试以下配置:

location / {
    rewrite \.(?:jpe?g|gif|png)$ /wp-content/plugins/adaptive-images/adaptive-images-script.php last;
    try_files $uri $uri/ /index.php?$args;
}

# other locations here
...

location ~* .(js|css|ico)$ {
    expires               60d;
    log_not_found         off;
}
本文链接:https://www.f2er.com/3108532.html

大家都在问