nginx
代理SSL并将
next
应用程序运行为
http
。我还看到了有关
--experimental-https
的帖子。我的用例: 我使用SSL设置了
nginx
。但是,我要求使用
next
启动https
以使加密模块可以工作。
我尝试在我的
--experimental-https
中添加package.json
:
"scripts": {
"dev": "next dev --turbopack --experimental-https",
"build": "next build",
"start": "next start --experimental-https",
"lint": "next lint",
"start:dev": "cross-env-shell ./node_modules/.bin/next dev"
},
运行npm run dev
起魅力,实现了SSL支持。
构建和运行
npm run start
给出了错误:
error: unknown option '--experimental-https'
next
?
因此,一些研究表明,不可能使用
https
启用
NextJS
启动https
Instead,您必须使用支持
--experimental-https
https
nginx
并代理结果的服务。我对此有怀疑,但我想澄清现在。 只是一个旁注 - 我发现的一个答案都没有(尽管是的,解决问题的方法)并未明确说明是否可以这样做,这就是我的问题是在问。我不是在问
how to setup nginx for https with nextjs in production
。