Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have magento configured with nginx, we are trying to use http//magentohost/api/rest to manage customers, but when we try to access that url i get 404.

Just wondering anybody proper configuration for the magento REST api url with nginx

our configuration

server {
  listen 80;
  access_log /var/log/nginx/;
  error_log  /var/log/nginx/;

  root /home/store/public_html;

  location / {
    index    index.php index.html index.htm;
    try_files $uri $uri/ @handler; ## if missing pass the URI to magento's front handler
    expires 30d; ## assume all files are cachable

  ## These locations would be hidden by .htaccess normally
  location /app/                { deny all; }
  location /includes/           { deny all; }
  location /lib/                { deny all; }
  location /media/downloadable/ { deny all; }
  location /pkginfo/            { deny all; }
  location /report/config.xml   { deny all; }
  location /var/                { deny all; }

  location @handler { ## Magento uses a common front handler
    rewrite / /index.php;
  location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
    rewrite ^(.*.php)/ $1 last;

  location ~ \.php$ {
    if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
    expires        off; ## Do not cache dynamic content 
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param  MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
    fastcgi_param  MAGE_RUN_TYPE store;

  location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
    access_log        off;
    log_not_found     off;
    expires           36d;
  location ~ /\.ht {
    deny all;
  location ~ /\.hg {
    deny all;

  location /nginx_status {
     stub_status on;
     access_log   off;
     allow ip;
     deny all;

share|improve this question
This seems like a good solution for this: – ZeiP Apr 12 at 12:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.