I want to know how to deploy my node.js
application (it uses Koa
) on Windows 10, Windows server 2012 and newer.
In Internet I see old tips for using iisnode
, but at the same time I see that people worry that developers no answer for many important questions (related with iisnode
) and long time doesn't make changes to the iisnode
code sources. :(
What is modern way to hosting node.js
applications on Windows 10 and Windows Server 2012 and newer?
I would be grateful for link to step-by-step article.
There are a few ways you can run NodeJS on Windows for production workloads.
It's important to first understand that Windows has built-in (kernel mode!) support for HTTP servers called HTTP.sys
which IIS and other web-servers use to serve HTTP traffic rather than simply opening a listening socket on port 80 (this is how Microsoft's IIS beat the pants off Apache in the web-server benchmarks back in the late 1990s).
Your options are:
HTTP.sys
first.HTTP.sys
iisnode
library also wrote another lib called httpsys
for NodeJS (as running behind IIS uses many of the same techniques as running behind HTTP.sys
): https://github.com/tjanczuk/httpsys - unfortunately it's out of date, but there really isn't much code to it so you can probably hack it yourself to work with the latest versions of Node. This is one of the points of open-source! ("Don't complain, fix it!")Run NodeJS behind IIS with Microsoft's fork of iisnode
:
iisnode
is abandoned, Microsoft actually took over ownership and forked it to https://github.com/Azure/iisnode which does seem to be actively maintained - and Microsoft has a vested interest in maintaining it because Microsoft wants to make money from the world running its apps on Azure regardless of whatever language, platform or OS they're using.Run NodeJS behind an nginx
port for Windows
One last option (and probably the best for your situation) is to run NodeJS on Windows as-is and use IIS' Application Request Routing (ARR) feature:
nginx
is a lightweight reverse-proxy). See here: https://www.iis.net/downloads/microsoft/application-request-routing with step-by-step instructions here: https://dev.to/petereysermans/hosting-a-node-js-application-on-windows-with-iis-as-reverse-proxy-397b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With