由于某些原因,“开箱即用”的Wordpress JSON API不能在Nginx上工作。我在nginx conf中尝试了几个重定向方案。我唯一能工作的就是?json。但是,这不适用于身份验证和注册。
作为一名FYI,我正在开发一个cordova应用程序,并尝试使用WP后端的WP JSON API。
发布于 2015-05-25 05:22:04
我找到了这个问题的解决方案。在你认为(像我一样)这是插件的问题之前,请确保固定链接正常工作。
我能够在nginx站点的子目录中更正wordpress站点的固定链接。如果您遇到同样的问题,本文将对您有所帮助,here
发布于 2018-06-07 14:51:23
我的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;
}发布于 2020-05-24 12:53:44
我的案例是将wordpress部署到我的网站根目录下的一个子目录中,下面是让它正常工作的步骤
www.abc.com
/www/wwwroot/www.abc.com/public/ - access通过www.abc.com
/www/wwwroot/www.abc.com/public/blog/ -访问通过www.abc.com/blog/
blog
chmod -R www:www blog -在您的web根目录中运行此命令。
location /blog/ {
index index.php;
try_files $uri $uri/ /blog/index.php?$args;
}https://stackoverflow.com/questions/30379940
复制相似问题