mardi 31 octobre 2017

When I use ember.js and rails, nginx conf how to work?

My project design like this, /team url and /team/* will use ember.js. The other also use rails, and I set nginx conf:

upstream project {
  server unix:///tmp/project.sock;
}

server {
  listen 80;
  server_name www.project.io;
  root /home/deploy/www/project_backend/current/public;

  location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect off;

    if (-f $request_filename/index.html) {
      rewrite (.*) $1/index.html break;
    }

    if (-f $request_filename.html) {
      rewrite (.*) $1.html break;
    }

    if (!-f $request_filename) {
      proxy_pass http://project;
      break;
    }
  }

  location /team {
    alias /home/deploy/www/project_frontend;
    try_files $uri $uri/ /index.html?/$request_uri;
  }
}

But this had some problems, when I use /team/ and will go to project_frontend index and /team/check/ or /team/project/check will go to rails page.

I don't know what's wrong with my .conf, Can you help me? Thanks.




Aucun commentaire:

Enregistrer un commentaire