Sharing Windows Server with Nodebb and Wordpress



  • I have really tried to solve this issue on my own, but the solution is just outside of my expertise and understanding. I have both my wordpress 'blog' and my nodebb forum both on an Amazon cloud Windows server 2008 R2, with IIS 7.5. They both run fine, however I want to address the Forum as something like fourm.theamericanbulletin.com instead of theamericanbulletin.com:8080. This seemed like a simple task, but has proven to be very difficult, with my experience. I have read post after post on codeproject... windows forums, and watch videos. I have install IISNode and tried to make that work ( nodebb did not like that!). I have configured IIS with URL Rewrite to route forum.* to port:8080... the list goes on. I know that IIS is a piggy and doesn't like to play with other servers, but can this really be that hard? I know that I am not the only one that has/will run into this issue. Has anyone successfully done or know how to do this?

    Before all you lynx users start in on me..... I have a headache already..... and yes.... lynx is scary. 🙂

    Thanks in advance.
    Rich



  • Use linux 😛



  • @Scuzz said:

    Use linux 😛

    Windows. Yeah I know. "Linux" is the favorite....

    63196_337778513009837_1545399136_n.jpg



  • No one is running both applications on a Windows server?


  • GNU/Linux Admin

    @RichG Unfortunately not 🙂 A bunch of linux people here, but now's as good a time to start as any!

    If you use our referral code, you get two months free (and help us keep the lights on a little bit!), and if you apply 10TOSHIP coupon code, you get another two months!

    Neato.



  • @julian Thanks for the generous offer. I am a big fan, and helping you, is more of an incentive than you know. The idea of starting from scratch with the workpress site, and the nodebb site is a daunting proposal.... everything is working except the rerouting the port :8080 thing. I have put so much time and effort into the whole 'self-hosting' deal, and I know nothing about linux. On the other hand, I do hate Windows. I need to think this over Sir...

    Rich



  • Hi Rich. We will help you with Linux. Nothing to worry about.



  • @RichG said:

    @julian Thanks for the generous offer. I am a big fan, and helping you, is more of an incentive than you know. The idea of starting from scratch with the workpress site, and the nodebb site is a daunting proposal.... everything is working except the rerouting the port :8080 thing. I have put so much time and effort into the whole 'self-hosting' deal, and I know nothing about linux. On the other hand, I do hate Windows. I need to think this over Sir...

    Rich

    Because you need to install NGINX, change Apache port to 8080, and Proxy Forward the Port 4567 to Port 80.



  • @RichG , you could try to create a reverse proxy inside IIS. I'm a fulltime sysadmin and have done this before, but it's been some time 😄
    If you still want to pull this off, I'll look at our servers at work.



  • @Moritz-Friedrich ... I really do want to pull this off. I have invested too much time, and I will not be the only one running into this issue. So far this is the best articiel I have come across that does not use iisnode.

    I installed in IIS.

    ARR (Application Request Routing)
    URL Rewrite
    

    and used rewitre to create this web.config file in the 'empty' directory FORUM that I created and pointed the application Forum to...

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
    <match url="(.*)" />
    <action type="Rewrite" url="http://theamericanbulletin.com:8080/{R:1}" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>

    http://theamericanbulletin.com/forum produces this...

    2015-04-14 07_28_02-Home _ American Bulletin.png



  • @RichG
    Could you please post config.json (with no passwords of course)?



  • As you can see the /forum does get hit and passed by IIS, but it does not stream back to the client all the .css, and other information to the browser. Plus if you click on a path deeper than the main page like 'Announcements' you get this server error. IIS is looking for a 'physical' path.

    2015-04-14 08_00_12-404 - File or directory not found..png

    Here is the json.config....

    {
    "url": "http://theamericanbulletin.com:8080",
    "secret": "bbbbbvvvccc",
    "database": "redis",
    "redis": {
    "host": "127.0.0.1",
    "port": "6379",
    "password": "xxxxxxx",
    "database": "0"
    }
    }



  • Okay. First off: Change the secret in your config.json immediately, you should never post it anywhere online.
    You should change the url here to "http://theamericanbulletin.com/forum". That way, NodeBB can deliver static resources with the correct path (remember, the client will request each resource based on this address which gets then parsed in the IIS).

    What are the rewrite rules shown in the ISS console?



  • I am almost 100% sure that I need a proxy server in-front of IIS to traffic the http request, but now we get into another level of complexity. That is why I hate Windows. I am going to explore finding a Nodejs app to set on port 80 and do the routing to IIS and noebb. Just to keep things simple. KISS.



  • @Moritz-Friedrich said:

    Okay. First off: Change the secret in your config.json immediately, you should never post it anywhere online.
    You should change the url here to "http://theamericanbulletin.com/forum". That way, NodeBB can deliver static resources with the correct path (remember, the client will request each resource based on this address which gets then parsed in the IIS).

    What are the rewrite rules shown in the ISS console?

    Done. I will try your suggestion. The rules...

    2015-04-14 08_33_31-52.11.104.152 - Remote Desktop Connection.png



  • @Moritz-Friedrich... "You should change the url here to "http://theamericanbulletin.com/forum"". Sorry.... no go. When I make your suggested change the nodebb start listening on it's default port 4567. Even changing web.config fro, :8080 to :4567 does not do the trick. and when access the forum from http:thaamericanbulletin.com:4567 then produces this result.... "/forum is append to 'all' the paths confusing nodebb. I think I need to write a 'small' node proxy to sit on :80. Isn't that where node shines...

    2015-04-14 10_34_18-Home _ American Bulletin.png



  • It's important that you know what these URLs mean. Look at this:

    1. Client requests theamericanbulletin.com/forum.
    2. IIS revieves a request for theamericanbulletin.com/forum and routes it to localhost:8080 or localhost:4567.
    3. NodeBB recieves a request from the client and uses theamericanbulletin.com/forum as a base URL to construct its relative links, eg. theamericanbulletin.com/forum/category/1/test.
    4. The client recieves the NodeBB page from theamericanbulletin.com/forum.

    That means, you have to configure the IIS to rewrite theamericanbulletin.com/forum to localhost:4567 (or :8080 respectively, that doesn't really matter apart from convention). NodeBB instead will think it sits on theamericanbulletin.com/forum all along.
    If you need further help setting up the rewrite rules, let me know.


  • GNU/Linux

    Best of luck to you @RichG. I did quite a bit of windows admin with IIS back in the day but I couldn't explain to you now how to do it without being on your system.

    If you still can't get IIS to play nice, may I suggest giving WAMP a try? It's basically the most popular linux web server: Apache, on windows. It will allow you to stick with windows but also use the suggestions and instructions from the nodebb documentation to get your proxy pass setup correctly. Additionally, configuring wordpress to use Apache instead of IIS is trivial.

    If you decide to go this route I can walk you through setting up apache and the vhosts required, just start a chat with me here.


  • GNU/Linux Admin

    @Moritz-Friedrich @KingCat You guys are awesome. 🙂



  • @Julian if I have some time this weekend, I could write a setup guide for IIS w/ screenshots, if you guys want it for the docs? With a big warning at the top, "Stop reading, use linux!" 😄


Log in to reply
 

Suggested Topics

  • 9
  • 5
  • 3
  • 1
  • 4
| |