IIS

将 Nitro 应用部署到 IIS。

#使用 IISnode

预设: iis_node

在您的 Windows Server 上安装最新 LTS 版本的 Node.js
安装 IISnode
在 IIS 中,将 .mjs 添加为新的 MIME 类型,并将其内容类型设置为 application/javascript
.output 文件夹的内容部署到 IIS 中的网站。

#使用 IIS 处理程序

预设: iis_handler

您可以直接使用 IIS HttpPlatformHandler。

在您的 Windows Server 上安装最新 LTS 版本的 Node.js
.output 目录复制到 Windows Server 中,并在 IIS 中创建一个指向该确切目录的网站。

#IIS 配置选项

nitro.config.ts
import { defineConfig } from "nitro";

export default defineConfig({
  iis: {
    // merge a pre-existing web.config file into the Nitro default file
    mergeConfig: true,
    // override the default Nitro web.config file altogether
    overrideConfig: false,
  },
});