For some reason "out-of-the-box" the Wordpress JSON API does not work on Nginx. I have tried several redirect schemes in the nginx conf. The only thing I have gotten to work is ?json
. However, this does not work for authentication and registration.
As an FYI, I am developing a cordova application and attempting to use the WP JSON API for WP backend.
Both Apache and NGINX work well with WordPress hosting.
The NGINX Controller API is a REST API that allows you to programmatically manage your NGINX Plus data planes. NGINX Controller follows an “API-first” approach, which means that all NGINX Controller functionality is exclusively exposed through declarative and resource-oriented APIs.
My 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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With