1.0.0 • Published 6 years ago
andrao-https v1.0.0
andrao-https
Letsencrypt SSL certificate renewal + http / https server initialization. letsencrypt-express wrapper.
Installation
npm install --save andrao-https
Usage
var servers = require('andrao-https')(app, {
domains: ['github.com', 'www.github.com']
, email: 'user@example.com'
});
servers
object contains native Node http and https listening at specified ports (default 80 for HTTP, 443 for HTTPS):
servers = {
http: [server@80]
https: [server@443]
}
Options
Key | Description | Default |
---|---|---|
domains | Certificate domains | [] |
email | Certificate email address | 'me@example.com' |
testing | Use staging server URL (for development) | false |
http_ports | HTTP server port(s) | [80] |
https_ports | HTTPS server port(s) | [443] |
redirect | Automatic HTTP -> HTTPS redirect | true |
Obtaining an SSL certificate via letsencrypt-cli
npm install -g letsencrypt-cli
For best results obtain cerificates individually for multiple domains, i.e. once for example.com
, and once for www.example.com
.
sudo letsencrypt certonly \
--agree-tos true --debug true --duplicate true \
--config-dir ~/letsencrypt/etc \
--email me@example.com \
--domains example.com \
--tls-sni-01-port HTTPS_PORT \
--http-01-port HTTP_PORT