Last active
August 22, 2024 16:57
-
-
Save mklooss/7300787 to your computer and use it in GitHub Desktop.
nginx magento configuration for API Calls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /api { | |
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; | |
} |
Soap v1 and v2 not working. I've used Magento 1.9.0.1.
I've updated this gist
Thanks for the gist. Not much documentation on this, I am afraid.
On Byte Hypernode, which is also nginx, the above code downloads the file api.php. So it seems the path is somehow not processed by the PHP interpreter.
Do you happen to have any experience with that? Or a suggestion as to what is happening?
EDIT
Found the answer. Byte Hypernode is running on a php/fpm nginx configuration. You'd need this:
location /api {
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;
}
}
The xmlrpc support need to be added
rewrite ^/api/xmlrpc /api.php?type=xmlrpc last;
Thank you. This worked great for me.
In one:
location /api {
rewrite ^/api/(\w+).*$ /api.php?type=$1 last;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works for you?
/api/rest - is ok.
soap and v2_soap - not ok.
api/v2_soap" failed (2: No such file or directory)