AWS Amplify
将 Nitro 应用部署到 AWS Amplify Hosting。
预设: aws_amplify
Read more in AWS Amplify 托管服务.
#部署到 AWS Amplify Hosting
Tip
与此提供商集成时无需进行零配置
点击“Get Started” > Amplify Hosting(Host your web app)
选择并授权访问您的 Git 仓库提供商,然后选择主分支
为您的应用选择名称,确保自动检测构建设置,并可选地在高级部分设置所需的环境变量
可选地,选择 Enable SSR logging,以启用将服务器端日志记录到您的 Amazon CloudWatch 账户
确认配置并点击“Save and Deploy”
#高级配置
You can configure advanced options of this preset using the awsAmplify option.
nitro.config.ts
import { defineConfig } from "nitro";
export default defineConfig({
awsAmplify: {
// 捕获所有静态回退:true,
// 图片优化:{ path: "/_image", cacheControl: "public, max-age=3600, immutable" },
// 图片设置:{ ... },
// 运行时: "nodejs24.x", // 默认值: "nodejs20.x" | "nodejs22.x" | "nodejs24.x"
}
})#amplify.yml
对于高级配置,您可能需要自定义的 amplify.yml 文件。以下是两个模板示例:
version: 1
frontend:
phases:
preBuild:
commands:
- nvm use 24 && node --version
- corepack enable && npx --yes nypm install
build:
commands:
- pnpm build
artifacts:
baseDirectory: .amplify-hosting
files:
- "**/*"