Article

  • 6 years

    6 years

    YetiShare / Core

    2430

API 404 Issue Using Nginx

Issue

Using the API on Nginx results in a 404 error on the API url.

Fix

Certain versions of Nginx handle rewrite rules slightly differently. To fix this, in your Nginx rewrite rules change this:

#location / {
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?_page_url=$1 last;
}
#}
To this:

location / {
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?_page_url=$1 last;
}
}
After the above updates, ensure you reload Nginx so the changes are enabled.

Alternative

Alternatively replace the entire API location section with the following:
rewrite ^/api/v2/(.*)$ /api/v2/index.php?_page_url=$1 last;