Can't open Nodebb with URL from config.json



  • Hi all, I have installed Nodebb v1.14.x and setup http://forum.example.com in config json and setup reverse proxy for nginx but I still can not open the forum with http://forum.example.com url. Only http://127.0.0.1:4567 is opened but with message "Looks like no connection to db".
    Can someone say what did I do wrong here?
    My configs are below:

    config.json

    {
        "url": "http://forum.example.com",
        "secret": "secret",
        "database": "mongo",
        "port": 4567,
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebb",
            "password": "password",
            "database": "nodebb",
            "uri": ""
        }
    }
    

    /etc/nginx/conf.d/nodebb.conf

    server {
        listen 80;
    
        server_name forum.example.com;
    
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://127.0.0.1:4567;
            proxy_redirect off;
    
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    
    

  • Community Rep

    @Evg-R Welcome to NodeBB 😎

    I am not noting anything awry config side and suspect your nodebb instance is unable to connect to your mongodb.

    1. I presume mongod is up and running?
    2. Have you confirmed mongod is indeed listening on port 27017 on the localhost, e.g.:
    
    [nodebb@forums]/opt/nodebb% netstat -na | grep -i listen| grep 27017
    tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN     
    unix  1      [ ACC ]     STREAM     LISTENING     38436    /tmp/mongodb-27017.sock
    
    [nodebb@forums]~% netstat -na | grep 4567
    tcp        0      0 127.0.0.1:4567          0.0.0.0:*               LISTEN     
    
    
    1. If so, have you confirmed that you are able to connect to mongod via cli as your nodebb user?

    2. If so... try launching nodebb w/the --log flag, e.g.:

    ./nodebb -l start
    

    Watch the messages that scroll by, eh? Then recheck what's happening on port 27017, should be something like:

    [nodebb@forums]/opt/nodebb% netstat -na | grep 27017
    tcp        0      0 127.0.0.1:64581         127.0.0.1:27017         ESTABLISHED
    tcp        0      0 127.0.0.1:27017         127.0.0.1:64581         ESTABLISHED
    tcp        0      0 127.0.0.1:58933         127.0.0.1:27017         ESTABLISHED
    tcp        0      0 127.0.0.1:27017         127.0.0.1:58933         ESTABLISHED
    tcp        0      0 127.0.0.1:61451         127.0.0.1:27017         ESTABLISHED
    
    

    Good luck and have fun! 🌻



  • Hi @gotwf

    1. mongo, nginx, nodebb are up and running
    2. Yep I left defaultlocalhost and port for mongo
    3. Yes I can connect by nodebb user I used Robo 3t app

    Here is what you asked to show:

    $ netstat -na | grep -i listen| grep 27017
    tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN     
    unix  2      [ ACC ]     STREAM     LISTENING     67480    /tmp/mongodb-27017.sock
    
    $ netstat -na | grep 4567
    tcp        0      0 0.0.0.0:4567            0.0.0.0:*               LISTEN     
    tcp        0      0 127.0.0.1:51200         127.0.0.1:4567          ESTABLISHED
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51190         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51196         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51192         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51186         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51194         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51200         ESTABLISHED
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51184         TIME_WAIT  
    tcp        0      0 127.0.0.1:4567          127.0.0.1:51198         TIME_WAIT 
    
    $ ./nodebb -l start
    
    Starting NodeBB with logging output
    Hit Ctrl-C to exit
    The NodeBB process will continue to run in the background
    Use "./nodebb stop" to stop the NodeBB server
    2020-07-11T22:15:19.667Z [4567/2725] - info: Routes added
    2020-07-11T22:15:19.669Z [4567/2725] - info: NodeBB Ready
    2020-07-11T22:15:19.670Z [4567/2725] - info: Enabling 'trust proxy'
    2020-07-11T22:15:19.673Z [4567/2725] - info: NodeBB is now listening on: 0.0.0.0:4567
    2020-07-12T11:09:05.195Z [4567/2725] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    2020-07-12T11:09:05.197Z [4567/2725] - info: [app] Web server closed to connections.
    2020-07-12T11:09:05.198Z [4567/2725] - info: [app] Live analytics saved.
    2020-07-12T11:09:05.205Z [4567/2725] - info: [app] Database connection closed.
    2020-07-12T11:09:05.211Z [4567/2725] - info: [app] Shutdown complete.
    [cluster] Child Process (2725) has exited (code: 0, signal: null)
    
    NodeBB v1.14.1 Copyright (C) 2013-2014 NodeBB Inc.
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it under certain conditions.
    For the full license, please visit: http://www.gnu.org/copyleft/gpl.html
    
    Clustering enabled: Spinning up 1 process(es).
    
    2020-07-12T11:09:08.931Z [4567/7317] - info: Initializing NodeBB v1.14.1 http://forum.example.com
    2020-07-12T11:09:11.883Z [4567/7317] - info: [socket.io] Restricting access to origin: http://forum.example.com:*
    2020-07-12T11:09:12.325Z [4567/7317] - error: [plugins] Error executing 'static:app.load' in plugin 'nodebb-plugin-emoji'
    2020-07-12T11:09:12.325Z [4567/7317] - error: Error: EACCES: permission denied, unlink '/var/www/nodebb/node_modules/nodebb-plugin-emoji/build/emoji/aliases.json'
    2020-07-12T11:09:12.358Z [4567/7317] - info: Routes added
    2020-07-12T11:09:12.361Z [4567/7317] - info: NodeBB Ready
    2020-07-12T11:09:12.363Z [4567/7317] - info: Enabling 'trust proxy'
    2020-07-12T11:09:12.365Z [4567/7317] - info: NodeBB is now listening on: 0.0.0.0:4567
    
    

    Rechecking what is hapenning on port 27017 after ./nodebb -l start:

    netstat -na | grep 27017
    tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN     
    tcp        0      0 127.0.0.1:27017         127.0.0.1:55190         ESTABLISHED
    tcp        0      0 127.0.0.1:55114         127.0.0.1:27017         ESTABLISHED
    tcp        0      0 127.0.0.1:27017         127.0.0.1:55188         ESTABLISHED
    tcp        0      0 127.0.0.1:55106         127.0.0.1:27017         ESTABLISHED
    tcp        0      0 127.0.0.1:55188         127.0.0.1:27017         ESTABLISHED
    tcp        0      0 127.0.0.1:27017         127.0.0.1:55106         ESTABLISHED
    tcp        0      0 127.0.0.1:27017         127.0.0.1:55114         ESTABLISHED
    tcp        0      0 127.0.0.1:55190         127.0.0.1:27017         ESTABLISHED
    unix  2      [ ACC ]     STREAM     LISTENING     67480    /tmp/mongodb-27017.sock
    
    

  • Community Rep

    While testing, I'd mind to 0.0.0.0 and confirm that connecting directly to the port produces a healthy page. You can close it after you are done troubleshooting.



  • @scottalanmiller

    Currently if I open http://0.0.0.0:4567/ I see home page but then message appears:

    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.
    

    if I open http://0.0.0.0 I see

    Welcome to nginx!
    

    http://forum.example.com/ is still can not be opened


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    Currently if I open http://0.0.0.0:4567/ I see home page but then message appears:
    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.

    You need to bind to 0.0.0.0, but not browse to it. That's not its address.

    http://yourip:4567/

    If that doesn't fix the connection issue, then we have a problem.


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    if I open http://0.0.0.0 I see
    Welcome to nginx!

    That's expected. You can't use 0.0.0.0 like that ever. And you can't use any IP address for this situation unless your default goes here, and it doesn't in your config, so that will never work.



  • Ok, what else should I check or setup to see NodeBB opened with http://forum.example.com in the browser? I can post any info to get help to solve this issue


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    Ok, what else should I check or setup to see NodeBB opened with http://forum.example.com in the browser? I can post any info to get help to solve this issue

    We're still trying to check the basics. Test http://yourip:4567/ and see if it is working correctly.



  • @scottalanmiller under "yourip" you mean IP address of the my linux ubuntu vm? It's dynamic ip, NAT shared from my laptop. I can not open NobeBB with http://myip:4567/ also


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    @scottalanmiller under "yourip" you mean IP address of the my linux ubuntu vm? It's dynamic ip, NAT shared from my laptop. I can not open NobeBB with http://myip:4567/ also

    It has to be accessible from somewhere, or the Nginx can't reach it, either.


  • Community Rep

    But we know it is reachable from somewhere, because you got an error from it. So use its IP from wherever that was.



  • @scottalanmiller And how to make it accessible for Nginx?



  • @scottalanmiller sorry I tried again and I could open http://myip:4567 but got the same message as for localhost:

    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.
    

  • Global Moderator

    You may not have port forwarding set up at your router so you can access it through the internet.

    Do you have another computer on your local network? You may be able to check if you can access it through your LAN.



  • @PitaJ Yes I haven't set up port forwarding for router. Could you specify which ports and ip to specify for forwarding ports?


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    @scottalanmiller sorry I tried again and I could open http://myip:4567 but got the same message as for localhost:

    Looks like your connection to NodeBB was lost, please wait while we try to reconnect.
    

    Ah, that will do it then. That's got to be solid and working before the proxy will work.


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    @PitaJ Yes I haven't set up port forwarding for router. Could you specify which ports and ip to specify for forwarding ports?

    It's the port you specified... 4567, and your IP address. The one that you just used to access it.



  • @scottalanmiller I have added forwarding port 4567 to router for ubuntu vm 192.168.1.4 TCP+UDP 4567 but I have still the same issues...


  • Community Rep

    @Evg-R said in Can't open Nodebb with URL from config.json:

    @scottalanmiller I have added forwarding port 4567 to router for ubuntu vm 192.168.1.4 TCP+UDP 4567 but I have still the same issues...

    That's not necessary. You were already testing from your LAN. Let's stay focused on testing one thing at a time. We don't want to jump around and get confused. (And now that we know your IP we can be explicit as to what we mean.)

    If you add a hosts entry for your 192.168.1.4 to your forum.example.com and you browse to http://forum.example.com:4567/ does the issue clear up?


Log in to reply
 

Suggested Topics

  • 10
  • 13
  • 3
  • 2
  • 4
| |