最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Deploying NodeJS application in IIS server - Stack Overflow

programmeradmin2浏览0评论

For the first time I am working on deployment of Angular application with Node JS as backend. I am looking for suggestions on certain questions. I am using NodeJS version 20 and Angular 17.

  1. To deploy NodeJS application, I see two ways, using IISNode and implementing reverse proxy. But I read that IISNode is not getting support any more; does it mean I cannot use IISNode at all?

  2. If I can use, then can I deploy latest version of NodeJS using IISNode. Will that be supported? I couldn't see any information regarding this.

  3. If I have to use Reverse proxy what does it really mean? The NodeJS application will be locally running in the server and all the requests will be redirected to it? What would be the pros and cons?

  4. I have used Express middleware in my application. Does it require anything extra for the deployment in IIS server?

I could see more examples of deployment processes but nothing talks about the right approach to be followed.

For the first time I am working on deployment of Angular application with Node JS as backend. I am looking for suggestions on certain questions. I am using NodeJS version 20 and Angular 17.

  1. To deploy NodeJS application, I see two ways, using IISNode and implementing reverse proxy. But I read that IISNode is not getting support any more; does it mean I cannot use IISNode at all?

  2. If I can use, then can I deploy latest version of NodeJS using IISNode. Will that be supported? I couldn't see any information regarding this.

  3. If I have to use Reverse proxy what does it really mean? The NodeJS application will be locally running in the server and all the requests will be redirected to it? What would be the pros and cons?

  4. I have used Express middleware in my application. Does it require anything extra for the deployment in IIS server?

I could see more examples of deployment processes but nothing talks about the right approach to be followed.

Share Improve this question edited Feb 2 at 22:51 halfer 20.3k19 gold badges109 silver badges202 bronze badges asked Jan 18 at 5:34 aniani 5162 gold badges12 silver badges36 bronze badges 2
  • The one stop place has existed for a while now, github/Azure/iisnode/issues/146 – Lex Li Commented Jan 18 at 9:37
  • Please ask questions one-at-a-time here. Several questions in one post will usually result in the question being put on hold. – halfer Commented Feb 2 at 22:52
Add a comment  | 

1 Answer 1

Reset to default 1

Please find the answers to your questions below:

1)To deploy NodeJS application, I see two ways, using IISNode and implementing reverse proxy. But I read that IISNode is not getting support anymore does it mean, I cannot use IISNode at all?

--> With the latest version of the node application it is recommended to use the reverse proxy instead of using iisnode as it has some compatibility issue.

2)If I can use, then can I deploy latest version of NodeJS using IISNode. Will that be supported ? I Couldn't see any information regarding this.

--> As a shared in previous answer it is recommended to use the reverse proxy instead of the iiisnode with latest application

3)If I have to use Reverse proxy what does it really mean? The NodeJS application will be locally running in the server and all the requests will be redirected to it ? What would be the pros and cons ? --> A reverse proxy setup means that IIS acts as a front-facing server, handling HTTP/HTTPS requests from clients. and it will help forward request to your locally running node js application. Pros:

  • Offload HTTPS processing to IIS, simplifying your Node.js
    application.
  • IIS can handle static files, reducing load on Node.js.
  • IIS provides additional layers like IP filtering, authentication,
    etc.

Cons:

  • It need you to set up the url rewrite rule to redirect the request
  • You might face some performance issue as request you are serving by the proxy.

4)I have used express Middleware in my application. Does it require anything extra for the deployment in IIS server ?

--> You just need to use the pm2 command to serve the node application no extra configuration is needed.

Here are the steps to serve the node js with angular app from IIS:

1)I am assuming you have configured the node js with angular

2)You can build the angular app by using command: ng build --prod

3)Create site in iis and use the dist folder as root website path

4)Install pm2 command: npm install -g pm2

after that start the server:

pm2 start server.js

5)Go to the iis angular website and add rule:

<system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:241/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

The rewrite url will be your node js application url which you will get by running the pm2 command

发布评论

评论列表(0)

  1. 暂无评论