由于某些原因,Wordpress JSON API“开箱即用”在Nginx上不起作用。我已经在Nginx conf中尝试了几种重定向方案。我唯一需要工作的是?json
。但是,这不适用于身份验证和注册。
作为FYI,我正在开发cordova应用程序,并尝试将WP JSON API用于WP后端。
最佳答案
我的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;
}
关于nginx - 如何使Wordpress JSON-API在Nginx服务器上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30379940/