0

I have a windows Server and installed IIS, on IIS php is installed. I have a Node js application I want deploy it to a directory like main application that is on php is accessible on www.test.com new Node application path would be www.test.com/new/ anyone know how to do that.

Awais
  • 63
  • 9

1 Answers1

1

There is a couple of ways how to run node.js with IIS (ARR or iisnode project). I prefer to do that with ARR. You need to follow this steps:

  1. You need to install ARR module and Rewrite module for IIS

  2. In IIS manager you should enable reverse proxy

    2.1. On server node click "Application Request Routing Cache"

    2.2. Click "Server proxy settings" and click "Enable proxy", then "Apply"

  3. Run your node.js application with the console or like win service with any different port. For example, it is port 3000

  4. In web.config of application www.test.com add this rewrite rule:

    <rule name="rewrite new to node.js" stopProcessing="true">
        <match url="^new(.*)" />
        <action type="Rewrite" url="http://localhost:3000{R:1}" />
    </rule>
    
  5. Try to make a call to www.test.com/new/

PS: You might have problems with links to your assets/images. Make sure that you using correct URL

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
Victor Leontyev
  • 7,865
  • 2
  • 13
  • 34