1

I'm running a meteor app on port 3000, not as root, and want nginx to redirect port 80 to port 3000.

I've followed the advice here.

This partly works, the front page comes up ok, but {{loginButtons}} does not render. I am using accounts-password with accounts-ui-bootstrap-dropdown.

The only changes that I've made to the default nginx config are these lines in the server section.

location ~* "^/[a-z0-9]{40}\.(css|js)$" {
  root /home/ubuntu/bundle/programs/client;
  access_log off;
  expires max;
}

location ~ "^/packages" {
  root /home/ubuntu/bundle/programs/client;
  access_log off;
}

location / {     
  proxy_pass http://localhost:3000/;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header Host $host;
}

The console reports an uncaught SyntaxError. Any suggestions?

Community
  • 1
  • 1
sreekar
  • 57
  • 2
  • Could you provide the syntax error? Its likely that you had this syntax error prior but in development mode the files aren't concatenated. In production/while in nginx the files are concatenated and a single syntax error can break your entire js up - since everything after the syntax error will not be interpreted – Tarang Jan 27 '14 at 15:40
  • The app works fine on port 3000. It is only on port 80 that this error arises. Uncaught SyntaxError: Unexpected token < 93e0a1fc236806dc020597e3c97a1b34fcc4dfcd.js:4 o.onfinish 93e0a1fc236806dc020597e3c97a1b34fcc4dfcd.js:4 o.emit 93e0a1fc236806dc020597e3c97a1b34fcc4dfcd.js:3 s.xhr.onreadystatechange 93e0a1fc236806dc020597e3c97a1b34fcc4dfcd.js:4 – sreekar Jan 27 '14 at 15:45
  • To clarify, this app is the result of `meteor bundle app.tgz` which has been unpacked on a server. – sreekar Jan 27 '14 at 15:51
  • Yes, when you bundle your app the error crashes your app. In development mode the error is still there but would be more benign. You have to look for this in development mode and fix it, then you wont have problems when you bundle. – Tarang Jan 27 '14 at 16:09
  • From what it looks like `Unexpected token <` you have a problem with paths that you are trying to include. Some package or something hasn't got its paths set correctly. If you viewed the file causing it in chrome inspector it wouldn't give you what it is (404)/take you to the homepage instead – Tarang Jan 27 '14 at 16:10
  • Interesting, so you're saying that it's possible that the path which causes the problem is well specified enough to work in production on port 3000, but is not sufficiently well specified to work with nginx in front? The app _does_ work in production, on port 3000. – sreekar Jan 27 '14 at 16:22
  • Does Nginx have any caching enabled? When access on port 3000 check that the file names for .js and .css are the same ones being requested as when you access on port 80. – user728291 Jan 28 '14 at 00:12

0 Answers0