【发布时间】:2020-06-04 10:49:16
【问题描述】:
我正在尝试使用 cloudfront 和 route53 将我的网站部署到 aws。该站点已在https://higgle.io 上部署和运行
但是资产没有加载,因为图像抛出 403。我该如何解决?
我正在使用无服务器 serverless-next.js。我正在关注他们的一篇博客文章进行设置。
到目前为止,我在路由级别添加了 serverless.yml。
higgle:
component: serverless-next.js
我的 next.config.js 看起来像
module.exports = {
target: 'serverless',
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config
}
}
虽然文件夹结构看起来像
-root
-.next
-pages
-_document.js
-index.js
-public
-static
-favicon.ico
-next.config.js
-package.json
-serverless.yml
知道如何解决这个问题吗? 谢谢
【问题讨论】:
-
你有没有想过,我有 1 个给出 403 的 fricken css 文件,只是想找出原因。
-
我的问题是图像,它位于
public文件夹内的static文件夹中,我将static重命名为images它开始工作。来到你的css问题,你已经添加了吗?还是 Nextjs 添加呢? -
是的,我确实遇到过,我只是将它移到 public/ 文件夹中,现在效果很好。
-
很高兴它工作了????
标签: amazon-web-services amazon-s3 amazon-cloudfront serverless-framework serverless