一文讲解Win10子系统安装与配置(分享)

lxf2023-03-11 20:38:01

其他回答《一文讲解Win10子系统安装与配置(分享)》中,来给大家了解到了Win10分系统安装与配备。下边本文为大家介绍如何使用Node.js中iis布署运作node,我们一起看看如何做。

一文讲解Win10子系统安装与配置(分享)

linux转移到windows server,一言难尽。在网上也有说iis早已适用node了。IIS Node忙活了一下,没奔跑起来,可能兼容模式没有那么好,干脆选择放弃。立即pm2启动了。

IIS Node详细地址:https://github.com/tjanczuk/iisnode/wiki/iisnode-releases

装上IIS UrlRewrite 详细地址:https://www.iis.net/downloads/microsoft/url-rewrite

在网站网站根目录建立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

阿里服务器是一个坑货啊,购买了2CES,到期了, 就想着不续订,再次转至中国香港算了吧,那样我在香港搭个VPN,超便宜,随后顺利地克服了越墙问题。

购买了台Window Server2008,一切准备就绪,任何东西都布署好啦。最后未过两个星期,提醒网站域名备案无效,加v认证无效,总而言之以前做的一切工作中,都不好使了。再度验证提醒,网络服务器没有在地区。中国香港不好。叫我转移回家。

说实在的中国香港的主机确实不太好,常常登录不上,vpn都是时断时续,基本上其实就是上不了网,恰好又出现行政策,未备案的域名终止分析。这一下网址基本上就挂了。

接着又转移回中国了。再次办理备案,再次加v认证一堆...

再从Window切出Linux。确实是很胡扯...

留一个纪录,怕哪一天又必须去瞎折腾IIS

强烈推荐学习培训:Node.js视频教学

以上就是关于一招教大家应用Node.js中iis布署运作node(附编码)的具体内容,大量欢迎关注AdminJS其他类似文章!