Gordon Bazeley
Gordon Bazeley

Reputation: 71

How to deploy ember-cli app onto nginx

I've been trying to deploy my ember-cli app in production mode onto an nginx server. I've reviewed the ember-cli docs and looked at other similar questions such as (How do I deploy Ember.js app developed with ember-cli on github pages?) - these seem to suggest that setting the ENV.baseURL variable in /app/config/environment.js should address issues but I can't find a value that works for me.

The files generated by ember build --environment production are at /Users/gordon/src/app/dist

The nginx config looks like:

server {
   listen       4200 ssl;
   server_name  localhost;

   ssl_certificate      /Users/gordon/src/app/server.crt;
   ssl_certificate_key  /Users/gordon/src/app/server.key;

   ssl_session_cache    shared:SSL:1m;
   ssl_session_timeout  5m;

   ssl_ciphers  HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers  on;
   root /Users/gordon/src/app/dist/;

   location / {
       # index  index.html;
     try_files $uri $uri/ /index.html?/$request_uri;

   }
}

In Users/gordon/src/app/config/environment.js if I leave ENV.baseURL at the default I get shown the following errors in my browser console ...

Uncaught TypeError: undefined is not a function vendor-70567c507a348c9884b7aba3ccaae1fd.js:14
Uncaught ReferenceError: DS is not defined

... if I set it to /Users/gordon/src/app/, /Users/gordon/src/app/dist/ or /Users/gordon/src/app/dist I get

Uncaught SyntaxError: Unexpected token < :4200/Users/gordon/src/sellthru/dist/assets/vendor-70567c507a348c9884b7aba3ccaae1fd.js:1
Uncaught SyntaxError: Unexpected token < :4200/Users/gordon/src/sellthru/dist/assets/sellthru-app-4b7e6077c7df38b31e70e32056d7d7aa.js:1
Uncaught ReferenceError: require is not defined 

I'm sure I'm probably missing something simple but can't for the life of me figure it out... If anyone is able to put me out of my misery I'd appreciate it ;-)

Upvotes: 7

Views: 5632

Answers (1)

Gordon Bazeley
Gordon Bazeley

Reputation: 71

Thanks to Jamie White we tracked down the issue to the ember-cli-bootstrap addon. I've removed that and manually added bootstrap now and all is sweetness and light. See also https://github.com/stefanpenner/ember-cli/issues/1727

Upvotes: 0

Related Questions