lundi 3 avril 2017

Index matching when putting EmberJS on Nginx

Right now I'm having difficulting matching my index page location in my nginx.conf to the index page file name auto-generated by Ember.

My file name is index.html:27450f1

And my nginx.conf file looks like

worker_processes 4;

events {
  use epoll;
  accept_mutex on;
  multi_accept on;
  worker_connections 1024;
}

http {
  gzip on;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  gzip_comp_level 2;
  gzip_min_length 512;
  gzip_proxied any;
  gzip_vary on;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  server_tokens off;

  tcp_nopush on;
  tcp_nodelay on;
  log_format l2met "measure#nginx.service=$request_time request_id=$http_x_request_id";
  access_log /logs/nginx/access.log l2met;
  error_log /logs/nginx/error.log;

  include mime.types;
  default_type application/octet-stream;
  sendfile on;

  server {
    listen 80;
    server_name ember.app;

    gzip on;
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types text/plain application/javascript application/json application/x-javascript text/css;
    gzip_vary on;

    root /mnt/frontend;

    location /api/ {
proxy_pass http://MYIPADDRESS;
      proxy_set_header Real-IP $remote_addr;
      proxy_set_header Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header NginX-Proxy true;
      proxy_ssl_session_reuse off;
      proxy_redirect off;
    }

    location = \index.html:27450f1$ {
      expires -1;
    }

    location ~* \.(ogg|ogv|svgz|mp4|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|html|txt|htm)$ {
      expires max;
      log_not_found off;
      access_log off;
      add_header Cache-Control public;
      fastcgi_hide_header Set-Cookie;
    }

    location ~* \.(eot|oft|svg|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
      expires max;
      log_not_found off;
      access_log off;
      add_header Cache-Control public;
      fastcgi_hide_header Set-Cookie;
    }

    location ~ /\. {
      deny all;
    }

    location / {
      expires -1;
      try_files $uri $uri/ /index.html:27450f1 =404;
    }
  }
}

Because it's not matching I'm getting a 403 error. How can I make sure my nginx.conf matches the auto-generated index name? At one point I also did ~ \index\:*+ and that didn't work either.




Aucun commentaire:

Enregistrer un commentaire