1. 程式人生 > >node + express + iis + iisnode + urlrewrite搭建站點

node + express + iis + iisnode + urlrewrite搭建站點

module handler config sof direct 文件 file bar fig

前提條件:安裝iis的電腦

準備條件:

1.下載iisnode 地址https://github.com/tjanczuk/iisnode/wiki/iisnode-releases 安裝

2.下載URL Rewrite 地址http://www.iis.net/downloads/microsoft/url-rewrite 安裝

3.地址 https://www.cnblogs.com/vipp/p/9145932.html,前9步驟搭建node站點

4.新建iis網站,設置如下

技術分享圖片

開始設置:

在node站點下新建web.config配置文件,內容如下:然後點擊最下面圖片所示位置進行訪問。

<configuration>
 <system.webServer>
 
   <!-- indicates that the hello.js file is
a node.js application to be handled by the iisnode module --> <handlers> <add name="iisnode" path="index.js" verb="*" modules="iisnode" /> </handlers> <!-- use URL rewriting to redirect the entire branch of the URL namespace to index.js node.js application;
for example, the following URLs will all be handled by index.js: http://localhost/foo http://localhost/bar --> <rewrite> <rules> <rule name="main"> <match url="/*" /> <action type="Rewrite" url="index.js
" /> </rule> </rules> </rewrite> <!-- exclude node_modules directory and subdirectories from serving by IIS since these are implementation details of node.js applications --> <security> <requestFiltering> <hiddenSegments> <add segment="node_modules" /> </hiddenSegments> </requestFiltering> </security> </system.webServer> </configuration>

技術分享圖片

node + express + iis + iisnode + urlrewrite搭建站點