Enable the magento API

in Nginx configuration

To enable the magento API, first create the correct users.

The magento api is supposed to work out-of-the box on hypernodes, but due to clean-url-rewrites sometimes the api does not work and returns a 404 error.
To resolve this issue, some additional configuration is required.

Use the following snippet to configure nginx for routing all api requests to api.php:

location /api {
    deny all;

    rewrite ^/api/rest /api.php?type=rest last;
    rewrite ^/api/v2_soap /api.php?type=v2_soap last;
    rewrite ^/api/soap /api.php?type=soap last;

    location ~ \.php$ {
        echo_exec @phpfpm;

This should work for both Magento 1 and Magento 2.

NB: If you don’t want to update ip addresses in all config files with every change of ip address, you can choose to use include files