Problems with NGINX config.



  • hey guys,
    fell in love with NodeBB as soon as i saw it, so i had to get it going for myself.
    signed up for a digital ocean droplet and seemed to have everything working.

    the only problem i have come across is with the NGINX proxy/redirect. i have never worked with it before, and while i have tried, it just doesn't seem to be working for me.

    i am trying to get the forum working on a subdomain from our main site, and without the need for the port.
    i have managed to get the subdomain working fine, as you can see at www.talk.cloudmounta.in:4567 but without the port there, it just shows the NGINX holding page.

    can anyone help me to get this working? i feel like i have just been going round in circles trying to get it to work...

    I have the NGINX config in a number of places:

    etc/nginx/conf.d/server.conf
    etc/nginx/nginx.conf
    etc/nginx/sites-available/default
    etc/nginx/sites-enabled/default
    

    using the same setup as the wiki (https://github.com/designcreateplay/NodeBB/wiki/Configuring-nginx-as-a-proxy-to-NodeBB) with NGINX 1.4.7

    my config.json file is as follows (with sensitive info removed)

    {
        "base_url": "http://talk.cloudmounta.in",
        "port": "4567",
        "use_port": true,
        "secret": "XXXXX",
        "bind_address": "127.0.0.1",
        "database": "redis",
        "redis": {
            "host": "127.0.0.1",
            "port": "6379",
            "password": "XXXXX",
            "database": "0"
        },
        "bcrypt_rounds": 12,
        "upload_path": "/public/uploads",
        "relative_path": ""
    }
    

    any pointers?


  • GNU/Linux Admin

    @QWUX Let's give this a shot 🙂

    1. Set use_port to false -- this won't fix anything, but if you're using nginx as a proxy, it should be set to false.
    2. Set bind_address to 0.0.0.0 -- no need to set it to anything different, in fact, I'm surprised it works at all since it's set to listen to the loopback iface.
    3. Remove the NodeBB nginx config lines from all of the files you specified, then (using sudo, or as root):
      • cd /etc/nginx/sites-available
      • nano www.talk.cloudmounta.in
      • Paste the contents of that nginx config into that file you just opened/created, then save & exit
      • cd ../sites-enabled
      • ln -s ../sites-available/www.talk.cloudmounta.in
      • service nginx reload

    Then run NodeBB, and give it a shot.



  • @julian thanks so much for your help.
    i started with a fresh install, and followed your instructions.
    everything seemed to work up until the
    service nginx reload. it says fail.

    any ideas?



  • also, i haven't been able to get any of the forever/supervisor installs to work. if the server reboots, nodebb still needs manual restart.

    i really like the way nodebb works and i want to use it for this project, but i fear the install process is still outside my skill level.



  • @QWUX

    The proxy configuration is obviously not working. Post the entire config for the forums Nginx file here and see if you can find any messages from /var/log/nginx/error.log that you can post here.



  • @planner thanks for the quick reply...

    sites-available/www.talk.cloudmounta.in:

    server {
    listen 80;

    server_name talk.cloudmounta.in;
    
    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://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";
    }
    

    }

    the error log located where you asked is empty.
    and i believe i had made a symlink in sites-enabled in the nginx dir.



  • @QWUX

    No need for posting the contents of nginx.conf. You may edit the post and delete that part and enclose the entire contents of sites-available.talk.. inside the code block.

    I think the problem it's not working properly is that the proxy_pass value does not match the base_url value in config.json. Set proxy_pass http://talk.cloudmounta.in:4567; and see if that works. Don't forget to restart Nginx and NodeBB before testing.


  • GNU/Linux Admin

    @QWUX said:

    service nginx reload. it says fail.

    Can you paste the entire error message?



  • @ planner @julian thanks for all the help guys.
    this is where i have gotten - www.talk.cloudmounta.in:4567

    i updated the sites-available/www.talk.cloudmounta.in to have the proxy pass http://talk.cloudmounta.in:4567; - but www.talk.cloudmounta.in still just shows the nginx start page.

    now, for some reason, after i installed the Facebook sso plugin, i can not login normally, the login page only shows the alternate login (fb).

    i got the nginx service to restart, just fine thank you @julian


  • GNU/Linux Admin

    If only the alternate login shows up, then local logins were disabled -- do you remember doing this?



  • i didn't remember doing it, but i have got them back (by reverting to a snapshot of my droplet).

    so, at this stage, still don't have the nginx proxy/redirect working, and when users are logged in, the top bar doesn't have the conditional menu as shown on this forum, it just displays "register login" as though no user were logged in. but when in the admin section, my user avatar shows up there.



  • @QWUX

    This is not working and Nginx's error log is empty. There's obviously something that's misconfigured. Are you running anything in front of Nginx, like a cache server?



  • @planner - as far as i am aware, no. this is my first time doing this kind of thing though. i used the NODEBB for dummies install guide.

    haha its making me feel stupid.

    i am so thankful for all the help so far, this is by far one of the most active and helpful communities i have encountered.

    how would i find out if i am running a cache server? would it be easier i if created a login for one of you? i don't want to keep taking up your time if i keep breaking things, but i am dead certain that of all the forum software i have seen, i want to use NodeBB for sure.



  • @QWUX

    Well, how did you set up the original website before installing NodeBB? And just out of curiosity, did you install Nginx fresh with NodeBB or Nginx is the Web server that powered the site before you installed NodeBB?


Log in to reply
 

Suggested Topics

  • 2
  • 12
  • 67
  • 4
  • 5
| |