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

Posted yue朔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了node + express + iis + iisnode + urlrewrite搭建站点相关的知识,希望对你有一定的参考价值。

前提条件:安装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搭建站点的主要内容,如果未能解决你的问题,请参考以下文章

在vs code中使用IIS Express插件启动出错 ‘We did not find a copy of IISExpress.exe at C:Program Files’

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

LeetCode 1066. Campus Bikes II

利用iisnode模块,让你的Node.js应用跑在Windows系统IIS中

117. Populating Next Right Pointers in Each Node II

Populating Next Right Pointers in Each Node II