如何在iis服务器10上部署下一个js 13应用程序

问题描述 投票:0回答:1
  1. 配置
    iisnode
    并重写。
  2. 在 iis 10 上部署 next.js 应用程序

很多文章解释不同的事情。首先,我们需要配置

iisnode
并重写吗?

web.config 配置也不同。

我尝试了很多时间,却发现了这个错误。

image

node.js next.js iis-10
1个回答
0
投票

您可以按照以下步骤在 iis 上托管下一个 js 应用程序。

  1. 安装最新的Node版本,iis节点模块,url重写模块

2)在 web.config 文件中添加以下代码:

<configuration>
  <system.webServer>    
    <rewrite>
      <rules>
        <rule name="myapp">
          <match url="/*" />
          <action type="Rewrite" url="server.js" />
        </rule>
      </rules>
    </rewrite>

    <iisnode node_env="production" nodeProcessCommandLine="&quot;E:\nodejs\node.exe&quot;" interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" />

  </system.webServer>
    <location path="" overrideMode="Deny">
        <system.webServer>
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>
        </system.webServer>
    </location>
</configuration>

根据你的机器文件位置设置路径。

确保运行 1npm run build1 命令

© www.soinside.com 2019 - 2024. All rights reserved.