带有 letsencrypt 的 KeystoneJS - 需要证书文件
KeystoneJS with letsencrypt - certificate files required
我正在学习本教程 Let’s Encrypt KeystoneJS! 以尝试让 letsencrypt 在我的 KeystoneJS 项目上工作。
但是,当我启动服务器时出现错误:
SSL Not Started: Invalid SSL Configuration (certificate files required)
我已经使用 certbot 将独立证书生成到目录 /home/example/letenscrypt
,结果是:
- accounts
- csr
- keys
- letsencrypt.log
- renewal
- renewal-hooks
我也试过在我的 keystone init 中定义 configdir:
keystone.init({
...
letsencrypt: (process.env.NODE_ENV === 'production') && {
email: 'admin@myapp.com',
domains: ['www.myapp.com', 'myapp.com'],
register: true,
tos: true,
configDir: '/home/example/letsencrypt'
},
...
})
我也试过 configDir: '/home/example/letsencrypt/keys'
但我总是得到同样的错误,我想知道我错过了什么?
好的,所以问题是 NODE_ENV
没有正确设置为 production
。在我的 .env
中正确设置它解决了这个问题(但不幸的是引发了另一个生成无效证书的问题)
https://github.com/keystonejs/keystone/wiki/Deployment-Checklist
我正在学习本教程 Let’s Encrypt KeystoneJS! 以尝试让 letsencrypt 在我的 KeystoneJS 项目上工作。
但是,当我启动服务器时出现错误:
SSL Not Started: Invalid SSL Configuration (certificate files required)
我已经使用 certbot 将独立证书生成到目录 /home/example/letenscrypt
,结果是:
- accounts
- csr
- keys
- letsencrypt.log
- renewal
- renewal-hooks
我也试过在我的 keystone init 中定义 configdir:
keystone.init({
...
letsencrypt: (process.env.NODE_ENV === 'production') && {
email: 'admin@myapp.com',
domains: ['www.myapp.com', 'myapp.com'],
register: true,
tos: true,
configDir: '/home/example/letsencrypt'
},
...
})
我也试过 configDir: '/home/example/letsencrypt/keys'
但我总是得到同样的错误,我想知道我错过了什么?
好的,所以问题是 NODE_ENV
没有正确设置为 production
。在我的 .env
中正确设置它解决了这个问题(但不幸的是引发了另一个生成无效证书的问题)
https://github.com/keystonejs/keystone/wiki/Deployment-Checklist