Strapi HTTPS Nginx 配置

问题描述 投票:0回答:2

我正在尝试使用 Strapi 设置一个节点 WebApp 作为 CMS,两者都运行在 Nginx 上。遵循 strapi 文档后,我可以访问登录页面,但每次 POST 尝试都会返回 500 内部服务器错误。

Response with error

在 Nginx 访问日志上我得到:

"POST /strapi/admin/forgot-password HTTP/1.1" 500 134 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0" 
"POST /strapi/admin/login HTTP/1.1" 500 134 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

在 Strapi CLI 输出中,我只看到 GET 请求,看来 Strapi 没有收到 POST 请求:

Strapi CLI output

大家有什么建议吗?

谢谢!

node.js nginx strapi
2个回答
0
投票

我解决了它,我必须将 webapp url 添加到 /config/middleware.js 中的 cors 设置

enter image description here


0
投票

我在生产服务器中针对获取请求遇到了相同的错误。我已经删除了 ngnix 配置并在 80 端口上运行我的 Strapi 服务器。

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 80),
  url: 'http://example.com/strapi',
});
© www.soinside.com 2019 - 2024. All rights reserved.