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.com$" />
                    </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.com$" />
                    </conditions>
                    <action type="Rewrite" url="http://127.0.0.1:7005/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

其中有三条规则,第一条是 https 的转发
第二条和第三条分别是把来源是 主记录(chuchur.com)和别名(www.chuchur.com)的 统统转发到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 邱秋 阅读( ...) 评论( ...) 编辑 收藏
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]和\[2\]提供了关于在IIS部署chatgpt-next-web的配置示例。根据这些示例,你可以按照以下步骤进行部署: 1. 首先,你需要修改web.config文件。根据\[1\]中的示例,你需要将url rewriter节中的index.js/debug地址设置为不匹配negate="true"。这可以通过在rewrite规则中添加`<match url="index.js/debug" negate="true" />`来实现。 2. 接下来,你需要创建一个Web.config文件并将其放置在chatgpt-next-web目录中。根据\[2\]中的示例,你需要在该文件中添加iisnode的处理程序和rewrite规则。处理程序的路径应该指向chatgpt-next-web的启动程序,例如`bin/www`。 3. 确保bin目录是chatgpt-next-web的默认输出目录,并允许模块调用。这可以通过在Web.config文件中设置正确的路径来实现。 4. 最后,你可以在浏览器中打开`http://localhost/myapp/`来访问chatgpt-next-web应用程序。如果一切配置正确,你应该能够成功访问应用程序。 需要注意的是,这只是一个示例配置,具体的部署过程可能因你的环境和需求而有所不同。你可能需要根据实际情况进行适当的调整和配置。 #### 引用[.reference_title] - *1* *2* [crossplatform---Nodejs in Visual Studio Code 10.IISNode](https://blog.csdn.net/weixin_33991727/article/details/93280120)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [JSP住宅小区物业管理系统(源代码+开题报告+论文+答辩PPT)](https://blog.csdn.net/m0_73546099/article/details/130682154)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值