[SOLVED] Trouble with Nginx
-
First of all, hi NodeBB community.
I have some issues with proxying via Nginx.
My config regarding the NodeBB installation looks like this (server_name and root values are obviously not real):
upstream nodebb { server 127.0.0.1:8997; } server { listen 80; server_name subdomain.domain.com; root /path/to/nodebb; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://nodebb/; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
When I try to open "subdomain.domain.com" in my browser everything seems fine, but the settings menu in the admin panel is actually borked beyond reasoning.
When I try clicking on the tabs (Privilege Thresholds, Email, User, Post, Web Crawler) I get this message in the console:
*Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist. *When I run the application using IP and port, it works flawlessly, so this has something to do with the proxy and possibly the sockets. My config.json and public/config.json are untouched, although I tried to set config.socket.address and config.socket.port before but it didn't do any good.
If anyone has ideas, I'm all ears.
Edit: Looks like the socket connection times out. Maybe it does have something to do with public/config.json.
Edit 2: No it doesn't.
Edit 3: Looks like the root cause is the version of my Nginx installation. Nginx supports websocket proxying from 1.3. I'll upgrade my Nginx and we'll see how it goes.Solution:
Debian Wheezy repos only contain Nginx 1.2.1 as the current stable version (which is outdated only by mere 2 minor versions) and that version can't handle websocket proxying.
If you happen to have Wheezy and/or Nginx <1.3, upgrade to the latest (1.4.4 as I write this post) version using backports. -
@barveyhirdman Whoa, this is news to me. We recently added the tabs in the Settings menu, but typically, when users try to install NodeBB with an older version of nginx, they do not typically run into problems except with their web sockets not working. Instead, socket.io will drop down to xhr or jsonp polling.
The readme mentions the lower limit requirement of nginx being 1.3.13, so I'm glad your upgrading to 1.4.4 fixed it
-
@julian as I saw it tried to do that, but for some reason it still couldn't handle the login. Every time I tried to sign in, it showed the admin menu, but for example couldn't create a new topic because I wasn't logged in.