最近有个主题客户反馈说,网站无法通过Gutenberg编辑器发布和修改网站内容,提示“此响应不是合法的JSON响应”,禁用所有插件,并且切换回WordPress自带的官方主机,问题依旧,说明不是主题和插件导致的。
开启浏览器调试默认,可以看到下图错误:
访问 工具 – 站点健康 界面,可以看到提示 REST API 遇到错误:
然后访问他网站的文章和其他页面,都返回 404 错误,所以确定问题应该是出在伪静态规则方面。
登录他的主机管理后台,发现采用的是阿里云的云虚拟主机增强版,阿里云增强版Linux操作系统云虚拟主机的Web服务采用Nginx1.18引擎,在面板的 高级环境设置 – Nginx设置 界面,添加下图的伪静态规则,然后就一切正常了:
伪静态规则:
location / {
try_files $uri $uri/ /index.php?$args;
}
更多的细节,请看阿里云官方帮助文档:https://help.aliyun.com/document_detail/197376.html
来源:
https://www.wpdaxue.com/aliyun-wordpress-rest-api-error.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_33581.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57