I have a Rails 4.2.2 app running on my domain (root '/'), and have an admin interface in Ember-CLI (/admin path of that domain). I deployed everything and my Rails app is functional on the domain (unicorn+nginx), but when I go to the route /admin, I get a 403 Forbiddon error from nginx. Sometimes I get a 405, 404 etc (depending on my configuration, which is trial and error). My nginx server block looks like this:
upstream unicorn_rails {
server unix:/tmp/unicorn.rails.sock fail_timeout=0;
}
server {
listen 80 default;
server_name staging.domain.com;
root /var/www/ember-cli/current/dist;
location ~ /admin {
alias /var/www/ember-cli/current/dist;
try_files $uri $uri/ /admin/index.html?/$request_uri;
access_log /var/www/rails-app/shared/log/nginx.access.log;
error_log /var/www/rails-app/shared/log/nginx.error.log;
}
location / {
root /var/www/rails-app/current/public;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn_rails;
access_log /var/www/rails-app/shared/log/nginx.access.log;
error_log /var/www/rails-app/shared/log/nginx.error.log;
}
As I said, the unicorn_rails proxy pass works, which is just an upstream block declared at the top of my file. It looks like the /admin location block is wrong. Currently, I'm getting the following error from nginx:
2015/07/17 13:40:16 [error] 29498#0: *2 directory index of "/var/www/ember-cli/current/dist" is forbidden, client: 94.227.132.57, server: staging.domain.com, request: "GET /admin/ HTTP/1.1", host: "staging.domain.com", referrer: "http://ift.tt/1SrvabP"
My permission are set correctly (chmod 755) on the /dist folder.
Any idea?
location /admin {
RépondreSupprimeralias /var/www/ember-cli/current/dist;
try_files $uri $uri/ /admin/index.html;
}
location /admin {
RépondreSupprimeralias /var/www/ember-cli/current/dist;
try_files $uri $uri/ /index.html =404;
break;
}
in config\environment.js
module.exports = function (environment) {
let ENV = {
rootURL: '/admin/',
................