config.json updated, `base_url` and `relative_path` no longer exist

NodeBB Development
  • Re: gh#1984

    The configuration file was recently updates to be simpler, among other changes, url is the main config value that points to your address. NodeBB will automatically figure out the port usage and relative path if provided.

    port is now optional. If it is not specified, it will be inferred from the url, if it is not specified in the url (e.g. you're using a reverse proxy) and you still want to listen to a non-4567 port, specify a port value, NodeBB will follow it. The PORT environment variable is unaffected.

    bcrypt_rounds and upload_path are defaulted to 12 and /public/uploads respectively. Leave them in config.json if you want them to be different.

    NodeBB's upgrade script will transparently handle this change, although if you have plugins relying on base_url, you'll need to update them to listen for url instead.

    Full details here: https://docs.nodebb.org/en/latest/configuring/config.html

  • To be clear, we can still access relative_path through nconf.get('relative_path') right? -- this just affects people that may be accessing this stuff before it's parsed into that.

  • @dwn Yes, sorry, I tried to make this change as backwards compatible as I could, so all existing values except for base_url are maintained.

    nconf.get('relative_path'); will function as it has before.

  • Hi,

    so if I do understand it right - NodeBB is now supporting subfolder installations? If yes, how do I configure NodeBB to do so? Cant figure it out from the docs...

  • @silasrech When you run ./nodebb setup it asks for the url of your forum. Just put in http://yourdomain.com/myforum

  • Okay, and how do I have to configure NGINX? Just:

       server {
            server_name domain.tld;
            location /forum/ {
            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:<port>/;
            proxy_redirect off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            }
       }
    

    ?

  • @silasrech If you put location as /forum/, nginx will remove that portion of the URL when proxying, and NodeBB will actually see requests for /topic/ /category, etc, so if you wish, you can do that and change the url to be without the subfolder.

    OR

    Leave it as location /, and have the url property in the config have the subfolder.

  • Okay, thanks. Merry Christmas and Happy New Year by the way 😃

  • Finally upgraded to 0.6.1 from 0.5.7. First I added the port (in my case 8080) to the URL string as described in this thread. That screwed up SSO. Both google and facebook. After, I went back and manually added "port" setting into config.json, SSO seems functional. This appears to be a bug or a logical conflict. Basically SSO is not functional unless your URL string is exactly how you access nodeBB from the outside.

  • @Baerrus This is what it's supposed to be due to my understandings.

    The url attribute needs to be the URL how you access NodeBB from the outside.
    The port attribute defaults to 4567 (or to port specified within url if specified) and is the port NodeBB attaches to on localhost.

    Some examples:

    • {"url": "http://example.com:8080"}
      NodeBB binds to 8080 and expects no reverse-proxy thus from the outside you access it via http://example.com:8080
    • {"url": "http://example.com"}
      NodeBB binds to 4567 and expects outside-access to be via http://example.com
    • {"url": "http://example.com", "port": 8080}
      NodeBB binds to 8080 and expects outside-access to be via http://example.com
  • @frissdiegurke Knowing what I know now, @julian post can be construed to contain all the information :). I would word it differently though as SSO is probably veyr widely used. And if so, then calling port optional is...well, still technically correct.


Suggested Topics