Magento REST API rest连接在localhost主机中工作,但不工作在服务器上

时间:2014-11-06 07:06:56

标签: magento java-ee

我在Windows上使用Magento 1.7.0.2 RestAPI没有问题。

在Linux上安装了一切,但是几个网址或重写规则似乎无法正常工作。

例如http://example.com/magento/restconnect总是给我“404。”

这表明“RewriteRule ^ api / rest api.php?type = rest [QSA,L]”不起作用。

当我使用“RewriteRule ^ api api.php?type = rest [QSA,L]”时,它可以工作,但在以后的REST通信中也无济于事。

另一个迹象是: http://example.com/magento/admin/oAuth_authorize?oauth_token= ... 导致“哎呀,我们的坏......” - 所以没有回应或坏的网址。

有人提示吗?所以它与REST功能有关。

2 个答案:

答案 0 :(得分:0)

 your server is nginx? i also have 404,i was so resolved,
 nginx conf configuration :
 server {
 listen 80;
 server_name mg.nieger.com;
 index index.html index.htm index.php;
 root /alidata/www/nieger;
 location ~ .*\.(php|php5)?$
 {
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
 }
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
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;
} 
#
include /alidata/server/nginx/conf/rewrite/magento.conf;
log_format nieger '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /alidata/log/nginx/access/default.log nieger;
}

i added the: 

**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;
}**

答案 1 :(得分:0)

问题解决了。这个链接的最佳答案。 linux服务器区分大小写

http://www.magentocommerce.com/boards/v/viewthread/295638/