如何让Wordpress JSON-API在Nginx服务器上运行?

etr*_*rey 2 nginx json-api wordpress-json-api

出于某种原因"开箱即用",Wordpress JSON API无法在Nginx上运行.我在nginx conf中尝试了几种重定向方案.我唯一能做的就是?json.但是,这不适用于身份验证和注册.

作为一个FYI,我正在开发一个cordova应用程序并尝试使用WP JSON API进行WP后端.

nor*_*ree 14

我的Nginx conf for wp-json API。

location / {
    # http://v2.wp-api.org/guide/problems/#query-parameters-are-ignored
    try_files $uri $uri/ /index.php$is_args$args;
}

location ~ ^/wp-json/ {
    # if permalinks not enabled
    rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}
Run Code Online (Sandbox Code Playgroud)


etr*_*rey 5

我找到了问题的解决方案.在假设(就像我这样做)插件的问题之前,请确保永久链接正常工作.

我能够在nginx网站的子目录中更正wordpress网站的永久链接.如果您在此处遇到同样的问题,本文将为您提供帮助

  • 链接已死 (3认同)
  • 你永远不会怀疑最简单的事,谢谢; 为我节省了很多时间! (2认同)