[英]Let's encrypt with Sails.js
Has anyone been able to use let's encrypt node module ( https://git.coolaj86.com/coolaj86/greenlock-express.js ) with Sails.js?有没有人能够在 Sails.js 中使用让我们加密节点模块( https://git.coolaj86.com/coolaj86/greenlock-express.js )? A little pointer would be helpful.
一个小指针会有所帮助。
Yes, you can use greenlock-express.js for this to achieve SSL with LetsEncrypt directly within the Sails node environment.是的,您可以使用greenlock-express.js直接在Sails节点环境中通过LetsEncrypt实现 SSL。
The example below:下面的例子:
Sample configuration for config/local.js
: config/local.js
示例配置:
// returns an instance of greenlock.js with additional helper methods
var glx = require('greenlock-express').create({
server: 'https://acme-v02.api.letsencrypt.org/directory'
, version: 'draft-11' // Let's Encrypt v2 (ACME v2)
, telemetry: true
, servername: 'domainname.com'
, configDir: '/tmp/acme/'
, email: 'myemail@somewhere.com'
, agreeTos: true
, communityMember: true
, approveDomains: [ 'domainname.com', 'www.domainname.com' ]
, debug: true
});
// handles acme-challenge and redirects to https
require('http').createServer(glx.middleware(require('redirect-https')())).listen(80, function () {
console.log("Listening for ACME http-01 challenges on", this.address());
});
module.exports = {
port: 443,
ssl: true,
http: {
serverOptions: glx.httpsOptions,
},
};
Refer to the greenlock documentation for fine-tuning configuration detail, but the above gets an out-of-the-box LetsEncrypt working with Sails.请参阅 greenlock 文档以了解微调配置详细信息,但以上内容提供了一个开箱即用的 LetsEncrypt 与 Sails 一起使用。
Note also, that you may wish to place this configuration in somewhere like config/env/production.js
as appropriate.另请注意,您可能希望将此配置适当地放置在
config/env/production.js
类的地方。
我不得不将绿色锁降级到版本 2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.