uNoGS Forum
    • Categories
    • Search
    • unogs
    • Register
    • Login
    ad

    Get nodebb working with virtual host and sub directory on apache2.4

    General Discussion
    3
    6
    5.4k
    Loading More Posts
    • 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.
    • adminA
      admin
      last edited by admin

      One of the first issues I ran into getting nodebb working was getting it to play nice with my virtual host on apache. If you look at the documentation most of what you need is already there, but I wanted to get it working with my existing virtual host so I had to tweak it a bit.

      here is the relevant code for apache:

      <VirtualHost *:80>
      ServerAdmin admin@unogs.com
      ServerName unogs.com
      ServerAlias *.unogs.com
      ProxyRequests Off
      ProxyVia Off
      <Proxy *>
              Order deny,allow
              Allow from all
      </Proxy>
      # edit the next line if you use https
      RequestHeader set X-Forwarded-Proto "http"
      
      RewriteEngine On
      AllowEncodedSlashes On #important for the admin interface on nodebb
      RewriteCond %{REQUEST_URI}  ^/forum/socket.io            [NC]
      RewriteCond %{QUERY_STRING} transport=websocket    [NC]
      RewriteRule /forum/(.*)           ws://127.0.0.1:4567/forum/$1 [P,L]
      ProxyPass /forum/ http://127.0.0.1:4567/forum/ nocanon
      ProxyPassReverse /forum/ http://127.0.0.1:4567/forum/
      
      DocumentRoot /mydocroot #where the rest of the site lives
      </VirtualHost>
      

      The only real differences between this and the documentation are 'AllowEncodedSlashes On' which is necessary to get the admin interface working. and I have appended the '/' with '/forum/' to make only the forum sub directory reverse proxied.

      Next, to get the sub directory working you need to change your nodebb config.json file to the following:

      {
          "url": "http://unogs.com/forum",
          "secret": "itsasecret",
          "database": "mongo",
          "port": "4567",
          "mongo": {
              "host": "127.0.0.1",
              "port": "27017",
              "username": "xxx",
              "password": "xxx",
              "database": "xxx"
          }
      }
      

      I'm ashamed to say how long it took me to figure this out, but as you can see its working now.

      -admin

      1 Reply Last reply Reply Quote 0
      • ?
        Guest
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • ?
          Guest
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • ?
            Guest
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • ?
              Guest
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • ?
                Guest
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post