IIS 部署node

编程入门 行业动态 更新时间:2024-10-09 04:16:01

<a href=https://www.elefans.com/category/jswz/34/1765788.html style=IIS 部署node"/>

IIS 部署node

IIS 部署node

从linux 迁移到windows server,一言难尽.
网上有说iis已经支持node了. IIS Node

折腾了一下, 没跑起来,估计兼容性不是那么好,索性放弃了. 直接pm2 部署了.

安装了 IIS UrlRewrite

在站点根目录创建web.config, 内容如下

<?xml version="1.0" encoding="UTF-8"?>
<configuration><system.webServer><rewrite><rules><clear /><rule name="HTTP to HTTPS redirect" stopProcessing="true"><match url="(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{HTTPS}" pattern="off" ignoreCase="true" /></conditions><action type="Redirect" url="https://{HTTP_HOST}" redirectType="Found" /></rule><rule name="root"><match url="^(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{HTTP_HOST}" pattern="^chuchur$" /></conditions><action type="Rewrite" url="http://127.0.0.1:7005/{R:1}" logRewrittenUrl="true" /></rule><rule name="path"><match url="^(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{HTTP_HOST}" pattern="^www.chuchur$" /></conditions><action type="Rewrite" url="http://127.0.0.1:7005/{R:1}" /></rule></rules></rewrite></system.webServer>
</configuration>

其中有三条规则,第一条是 https 的转发
第二条和第三条分别是把来源是 主记录(chuchur)和别名(www.chuchur)的 统统转发到node端口上.

剩下的就是一个SPA 文档站点 (vue)

<?xml version="1.0" encoding="UTF-8"?>
<configuration><system.webServer><rewrite><rules><clear /><rule name="rest" stopProcessing="true"><match url="^rest/(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false" /><action type="Rewrite" url="http://127.0.0.1:7005/rest/{R:1}" /></rule><rule name="root"><match url="(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />  </conditions><action type="Rewrite" url="/index.html" /></rule></rules></rewrite><staticContent><mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" /></staticContent></system.webServer>
</configuration>

一起有2条规则, 第一条是一个proxy, 把/rest/ 转发到node端口的 /rest/上.
第二条是vue 路由history 模式的地址 Rewrite

阿里云是个坑货啊, 买了2年的CES,到期了, 我就想着不续费,重新转到香港算了,这样我在香港搭个VPN ,又便宜,然后顺利的解决了FQ的问题.

买了台Window Server2008 ,一切准备就绪,什么都部署好了. 结果没过两周 ,提示域名备案失效,个人认证失效,总之之前做的一切工作, 都没用了. 再次认证提示,服务器不在境内.香港不行. 要我迁移回来.

说实在的香港的主机真的不怎么样, 经常登录不上, vpn 也是时好时坏,基本也就是连不上, 正好又出了政策,未备案的域名停止解析. 这下网站基本就挂了.

于是又迁移回国内了.重新备案,重新个人认证一堆...
又从Window 切到Linux. 真的是很扯淡...
留个记录,怕哪天又要去折腾IIS.

posted @ 2019-03-02 18:29 邱秋 阅读( ...) 评论( ...) 编辑 收藏

更多推荐

IIS 部署node

本文发布于:2024-03-11 21:29:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1729937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:IIS   node

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!