How to set up NodeBB in a url below the root, and nginx front-end for that?



  • My NodeBB config contains:

    "url": "http://localhost:4567/forum"
    

    And My nginx config is:

    server {
    listen 80;
    
    server_name thesett.com;
    
    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://nodebb:4567/forum/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    }
    

    I am doing this because I would like the forums to appear under /forum relative to the site top-level, rather than as the top-level on a sub-domain.

    Is this possible to do, and how do I set it up? Thanks



  • I should add, the above set up seems to give me the home page, but without its CSS, and lots of broken links.


  • Admin

    Can you try removing "/forum" from proxy_pass?


  • GNU/Linux

    In addition to @julians fix:

    @willendure said:

    "url": "http://localhost:4567/forum"

    It's supposed to be the URL to access your board from outside. http://example.com/forum
    This probably causes some broken links.



  • @julian said:

    Can you try removing "/forum" from proxy_pass?

    Tried that and it seems to make no difference at all.



  • @frissdiegurke said:

    In addition to @julians fix:

    @willendure said:

    "url": "http://localhost:4567/forum"

    It's supposed to be the URL to access your board from outside. http://example.com/forum
    This probably causes some broken links.

    I replaced localhost with the ip address that I am testing this on, made no difference.

    I think I may need to look into nginx docs in more detail to see how to pass through a particular url.



  • Ok, got it working. I had to change:

    location /forum {
    

    To:

    location /forum/ {
    

    The extra slash on the end makes all the difference.


  • Admin

    Yeah, the nginx config for subfolder installs is a bit tricky :smile: Glad you got it working!


Log in to reply
 


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