Where can I change the websocket port

NodeBB Development
  • I'm checking nodebb v0.4.1 and I can't find where I can specify the websocket port it will connect. Please help.

  • @mnv2k2 You can change the websocket port in the config.json file, which automatically generated in the root of where NodeBB is installed on your server. For example if you installed NodeBB in /home/example/nodebb/* the config.json file will be located there.

    Here's what this file contains for example:

        "base_url": "http://example.com",
        "port": "8080", 
        "use_port": false,
        "secret": "",
        "bind_address": "",
        "database": "redis",
        "redis": {
            "host": "",
            "port": "6379",
            "password": "",
            "database": "0"
        "bcrypt_rounds": 12,
        "upload_path": "/public/uploads",
        "relative_path": ""

    8080 would be the port you would use to access your site.

  • @trevor Hi trevor, thanks for the quick reply. The problem with this is that my http port is different from my websocket port. My understanding is that the "port" in config.json is for http port (which happens to be also used by websocket? I'm guessing here). Is it possible to use a different websocket port?

  • Well depending on if you're using some type of front end web server such as nginx as a proxy to NodeBB or if another application is using port 80.

    If nginx is using port 80, then you will have to use change the nginx configuration as so: https://github.com/designcreateplay/NodeBB/wiki/Configuring-nginx-as-a-proxy-to-NodeBB

    If you are not using a web server such as nginx, you can go ahead and change whatever number that is to port 80 and it should run just fine without nginx. So if NodeBB is running on its default port of 4567, you can change this to 80.

    Let me know if this helps!

  • Our setup of socket.io has it using the same port that NodeBB serves on, just for convenience purposes. We haven't ever had a request to serve websockets on a separate port -- what benefit is there? (Honestly wondering)

  • Sorry for digging up an old thread, but for me, there would be a real benefit from having the websocket running on a different port.

    I run nodebb on shared hosting at uberspace.de, using Apache with Pound as a reverse proxy. Neither Apache nor Pound support websockets, so I’m stuck with the ajax fallback. This has become a real problem since in v0.6.1, the menu for category permissions in the admin panel works with websockets only. So I had the guys at uberspace open a port on the machine for me and installed the ssl certificate in nodebb. Now I can access my installation with websockets and everything, but have to use the port number in the url, which is rather ugly. Also, this breaks the non-websocket version without the port number, because in that case, Pound does the ssl for me, but now node tries to do it, too, because it detects the https in the request url …

    The ideal configuration for me, thus, would be to run the socket.io-portion of nodebb as an entirely different application on its own port with its own ssl configuration and so on. The web app would be served through the reverse proxy for nice urls and the browser would then talk to the socket.io-app running on its own port, bypassing Apache and Pound.

  • I am stuck with the same problem and I am on uberspace, too. You can set up a socket.io address in the config.json, but I did not yet find the correct setup to get it to work with https

  • @spicewiesel I have the same problem with https on uberspace, too. Did you found a solution for this issue? Here is my thread on this 😉 https://community.nodebb.org/topic/10719/websocket-connection-problems-via-ssl-on-special-port

Suggested Topics