• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Problem getting NodeBB to work on a subfolder rather than a subdomain

Scheduled Pinned Locked Moved Technical Support
7 Posts 3 Posters 3.3k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jop V.
    wrote on last edited by Jop V.
    #1

    NodeBB worked fine on a subdomain. However, I want to use HTTPS instead of HTTP, and I don't want to buy 2 certificates (or a wildcard certificate), so I'm trying to move it from http://forum.mydomain.com towards https://www.mydomain.com/forum in order to avoid getting an "incorrect common name" browser security warning. But I can't get it to work.

    When I try to visit it, I get nginx's standard message

    An error occurred. Sorry, the page you are looking for is currently unavailable. Please try again later. If you are the system administrator of this resource then you should check the error log for details. Faithfully yours, nginx.

    The error log (/var/log/nginx/error.log) says:

    2016/10/31 21:59:26 [error] 159#159: *2 upstream prematurely closed connection while reading response header from upstream, client: MyIPAddressHere, server: www.mydomain.com, request: "GET /forum HTTP/1.1", upstream: "http://127.0.0.1:4567/", host: "www.mydomain.com"
    

    This is my nginx config:

    ### redirects http requests to https
    server {
        listen 80;
        server_name www.mydomain.com;
    
        return 302 https://$server_name$request_uri;
    }
    
    ### the https server
    server {
        listen 443 ssl;
    
        server_name www.mydomain.com;
        root   /home/myusername/www/mydomain;
        location / {
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    
        ssl_certificate /etc/nginx/ssl/mydomain_com/ssl-bundle.crt;
        ssl_certificate_key /etc/nginx/ssl/mydomain_com/mydomain.key;
    
        # enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    
        # disables all weak ciphers
        ssl_ciphers 'AES128+EECDH:AES128+EDH';
    
        ssl_prefer_server_ciphers on;
    
        location /forum {
            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";
        }
    }
    

    This is my config.json:

    {
        "url": "https://www.mydomain.com/forum",
        "secret": "mysecret",
        "database": "redis",
        "redis": {
            "host": "127.0.0.1",
            "port": "6379",
            "password": "mypassword",
            "database": "0"
        }
    }
    

    I'm sure it's something really simple and I'm just overlooking something. Could anybody spot it for me? Thanks a lot!

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #2

    I realize this may not change your mind, but LetsEncrypt is a thing. They provide free TLS certs.

    J 1 Reply Last reply
    0
  • J Offline
    J Offline
    Jop V.
    replied to PitaJ on last edited by Jop V.
    #3

    @PitaJ Already got a Namecheap (Comodo) certificate for a year. I knew about Let's Encrypt but decided to just use my domain registrar.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to Jop V. on last edited by
    #4

    @Jop-V. that doesn't prohibit you from getting a LE cert for your subdomain.

    Regardless, @julian is the expert here

    1 Reply Last reply
    0
  • J Offline
    J Offline
    Jop V.
    wrote on last edited by Jop V.
    #5

    EDIT: Left my host's (weirdly chosen) username in

    I looked into NodeBB's log and I saw this (upon trying to visit the forum):

    1/11 10:38 [582] - error: TypeError: Cannot read property 'bootswatchSkin' of undefined
        at /home/myuser/nodebb/src/middleware/header.js:116:83
        at /home/myuser/nodebb/node_modules/async/lib/async.js:726:13
        at /home/myuser/nodebb/node_modules/async/lib/async.js:52:16
        at done (/home/myuser/nodebb/node_modules/async/lib/async.js:246:17)
        at /home/myuser/nodebb/node_modules/async/lib/async.js:44:16
        at /home/myuser/nodebb/node_modules/async/lib/async.js:723:17
        at /home/myuser/nodebb/node_modules/async/lib/async.js:167:37
        at /home/myuser/nodebb/src/meta/tags.js:110:4
        at /home/myuser/nodebb/node_modules/async/lib/async.js:726:13
        at /home/myuser/nodebb/node_modules/async/lib/async.js:52:16
        at done (/home/myuser/nodebb/node_modules/async/lib/async.js:246:17)
        at /home/myuser/nodebb/node_modules/async/lib/async.js:44:16
        at /home/myuser/nodebb/node_modules/async/lib/async.js:723:17
        at /home/myuser/nodebb/node_modules/async/lib/async.js:167:37
        at /home/myuser/nodebb/src/plugins/hooks.js:121:4
    

    Is it the same as this?

    TypeError: Cannot read property 'bootswatchSkin' of undefined · Issue #5145 · NodeBB/NodeBB

    https://github.com/boomzillawtf/tdwtf/tree/da8af063aa7b8ef7ef6c779a29b5dc7c6aa8f2bd https://github.com/NodeBB/NodeBB/tree/9cd29409f8db97fe9b822a5904ec1d97ef3978ad MongoDB 3.2.10 22/10 03:16 [4122] - error: TypeError: Cannot read property...

    favicon

    GitHub (github.com)

    Again, works perfectly without a subfolder.

    julianJ 1 Reply Last reply
    0
  • julianJ Offline
    julianJ Offline
    julian GNU/Linux
    replied to Jop V. on last edited by
    #6

    @Jop-V. Likely, yes... probably resolved if you use master

    1 Reply Last reply
    0
  • J Offline
    J Offline
    Jop V.
    wrote on last edited by Jop V.
    #7

    I updated to v1.3.0 and now I'm getting a different error when trying to visit the forum

    TypeError: Cannot read property 'loggedIn' of undefined
        at helpers.displayMenuItem (/home/myuser/nodebb/public/src/modules/helpers.js:20:44)
        at checkConditionalHelpers (/home/myuser/nodebb/node_modules/templates.js/lib/templates.js:269:76)
        at parse (/home/myuser/nodebb/node_modules/templates.js/lib/templates.js:424:15)
        at parseTemplate (/home/myuser/nodebb/node_modules/templates.js/lib/templates.js:133:14)
        at Object.templates.parse (/home/myuser/nodebb/node_modules/templates.js/lib/templates.js:119:11)
        at /home/myuser/nodebb/node_modules/templates.js/lib/templates.js:169:30
        at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
    
    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development