Moving from NodeJS to Nginx
-
So, first of all, I'm a complete noob at everything about web servers and such.
Basically, I have NodeBB running on port 80, and I installed it as it said in the guide for Ubuntu. I'm guessing it's running on NodeJS. Anyways, I want to move my forum to a subdomain, and Ik I need to do that with Nginx. That way, I can have a website on the main domain. So what do I need to do to have NodeBB running on Nginx on port 80 as a subdomain and still be able to run a website on the main domain, on port 80 as well? -
@Thouv you run NodeBB on a different port, and proxy that through nginx onto port 80. We recommend doing this even if you are only running NodeBB. Check out the example nginx configs in your docs.
-
@PitaJ said in Moving from NodeJS to Nginx:
@Thouv you run NodeBB on a different port, and proxy that through nginx onto port 80. We recommend doing this even if you are only running NodeBB. Check out the example nginx configs in your docs.
I wrote exactly what was written on there, with NodeBB running on 4567. When I start NodeBB, everything is fine, and there are no errors in the log. However, when I try to access my forums, I get a 502 Bad Gateway and this shows up in the log:
18/4 19:52:35 [8293] - error: TypeError: Cannot read property 'loggedIn' of undefined at helpers.displayMenuItem (/opt/nodebb/public/src/modules/helpers.js:20:44) events.js:160 throw er; // Unhandled 'error' event ^ Error: write after end at writeAfterEnd (_stream_writable.js:193:12) at LogStream.Writable.write (_stream_writable.js:244:5) at Socket.ondata (_stream_readable.js:555:20) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) at Pipe.onread (net.js:551:20)`
-
Nevermind, I got it fixed!
Had to set the url in NodeBB config to http://mydomain.com:4567 and setproxy_pass
to http://mydomain.com:4567 in Nginx config
Thanks @PitaJ -
@Thouv did you try with nginx still pointed to localhost:4567?
That should work, and also you might want to set
"bind_address": "127.0.0.1"
in config.json