Getting 502 Bad Gateway

Technical Support
  • A new installation fron a few days ago - I restarted the server and I get an error 502
    I would very much appreciated your help to understand what's wrong here

    Thanks you

    On systemctl status nginx.service & systemctl status nodebb.service

    May 26 00:47:02 test.wewp.net systemd[1]: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
    May 26 00:15:32 test.wewp.net systemd[1]: Can't open PID file /var/www/nodebb/pidfile (yet?) after start: No such file or directory
    
    
    • log
    NodeBB v1.10.2 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-05-25T21:13:23.104Z [1294] - info: Initializing NodeBB v1.10.2 https://test.wewp.net
    [benchpressjs] Unable to build or find a suitable native module, falling back to JS version
    2020-05-25T21:13:28.576Z [1294] - info: [socket.io] Restricting access to origin: https://test.wewp.net:*
    Mon, 25 May 2020 21:13:28 GMT hsts deprecated The "includeSubdomains" parameter is deprecated. Use "includeSubDomains" (with a capital D) instead. at node_modules/helmet/index.js:33:28
    Mon, 25 May 2020 21:13:28 GMT hsts deprecated The "setIf" parameter is deprecated. Refer to the documentation to see how to set the header conditionally. at node_modules/helmet/index.js:33:28
    2020-05-25T21:13:29.430Z [1294] - info: Routes added
    2020-05-25T21:13:29.438Z [1294] - info: NodeBB Ready
    2020-05-25T21:13:29.450Z [1294] - info: Enabling 'trust proxy'
    2020-05-25T21:13:29.459Z [1294] - info: NodeBB is now listening on: 0.0.0.0:4567
    2020-05-25T21:15:31.908Z [1294] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    2020-05-25T21:15:31.909Z [1294] - info: [app] Web server closed to connections.
    2020-05-25T21:15:31.913Z [1294] - info: [app] Database connection closed.
    2020-05-25T21:15:31.913Z [1294] - info: [app] Shutdown complete.
    
    • nodebb config file
    {
        "url": "https://test.wewp.net",
        "secret": "PASSWORD",
        "database": "mongo",
        "port": "4567",
        "mongo": {
            "host": "127.0.0.1",
            "port": "27017",
            "username": "nodebb",
            "password": "PASSWORD",
            "database": "nodebb"
        }
    }
    
    • nginx conf
    nginx conf
    server {
      listen [::]:443 ssl http2;
      listen 443 ssl http2;
      listen [::]:80;
      listen 80;
      
      server_name test.wewp.net;
      
      client_max_body_size 50M;
    
      # RSA
      ssl_certificate /etc/letsencrypt/test.wewp.net/fullchain.cer;
      ssl_certificate_key /etc/letsencrypt/test.wewp.net/test.wewp.net.key;
      # ECDSA
      ssl_certificate /etc/letsencrypt/test.wewp.net_ecc/fullchain.cer;
      ssl_certificate_key /etc/letsencrypt/test.wewp.net_ecc/test.wewp.net.key;
    
      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"; 
      }
    
    }
    
  • @shlomi said in Getting 502 Bad Gateway:

    A new installation fron a few days ago - I restarted the server and I get an error 502
    I would very much appreciated your help to understand what's wrong here

    Thanks you

    On systemctl status nginx.service & systemctl status nodebb.service

    May 26 00:47:02 test.wewp.net systemd[1]: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
    May 26 00:15:32 test.wewp.net systemd[1]: Can't open PID file /var/www/nodebb/pidfile (yet?) after start: No such file or directory
    
    

    Why not? I've not scrutinized the rest of your stuff but a couple quick questions:

    • What is the value of "User" in your nodebb.service? Does it match your nodebb user?

    • What is the value of "PIDFile" in your nodebb.service config?

    • What are the permissions for that directory and file?

    • What is the ownership for that directory and file?


Suggested Topics


  • 0 Votes
    3 Posts
    273 Views

    @PitaJ Thank you. How about this error that I am seeing in my browser console:

    Screen Shot 2019-04-19 at 7.32.08 PM.png

  • 0 Votes
    1 Posts
    234 Views

    I've been playing around with a new template and when view posts on a topic, I've managed to get it to colour the user's name with the same colour as the selected group as per their profile.

    Do you know how I can do this with the lastpost.tpl on category view? I've tried to do it the same way as I do with the post view, however when I look for the selectedGroup/selectedGroups array, I can't find it.

    Thanks in advance.

  • 0 Votes
    2 Posts
    1k Views

    @Jenni-D'Silva if you share the topic it's a permalink. The meta tags should be correct in the share.

    Meta tags only matter for SEO and that sort of thing, which use raw loads anyways, so I don't see the issue.

  • 0 Votes
    1 Posts
    648 Views

    A while back I restored my database from a backup, and I have a feeling that backup may have been corrupt.

    when I try to visit the admin/manage/groups page, my nodebb instance crashes and reboots. I get the error Cannot read property 'indexOf' of undefined. After doing a little debugging I found that that the query for groups:createtime (line 152 in src/database/mongo/sorted.ja), is returning some objects that DONT have "groups:createtime" as their key ... these documents don't have the expected schema, which is what's throwing that undefined error.

    I've found, using the mongo console, when I use find('_key': 'groups:createtime') I only get the objects I expect, but find('_key': \groups:createtime\) returns the bad objects (note that the substring "groups:createtime" appears nowhere in _key string for those objects). More upsettingly, if I remove those bad objects by their ObjectId, they STILL return in that query ... despite the remove command returning without error, despite no longer being able to look the object up by it's ID.

    I'm not clear on whether this is a NodeBB issue at all, or entirely on the Mongo side, but in the meantime, I can't edit anything in regards to groups (including adding/removing members to existing groups), and attempts at upgrading my forum version fail at the database migration step.

  • 1 Votes
    1 Posts
    845 Views

    I want to create page where I can get all pinned topics from all categories, I want to create something like "must read" page where all the topics which is marked must read by admin.