码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2018-06-11 18:54:06      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:ref   dex   for   cto   blank   main   config   handler   erb   

前提条件:安装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搭建站点

标签:ref   dex   for   cto   blank   main   config   handler   erb   

原文地址:https://www.cnblogs.com/vipp/p/9168301.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!