mirror of
https://github.com/therootcompany/greenlock-express.js.git
synced 2024-11-16 17:28:59 +00:00
Compare commits
5 Commits
e6a008d498
...
cf93c77bd5
Author | SHA1 | Date | |
---|---|---|---|
cf93c77bd5 | |||
c9363bd1a3 | |||
99f6ab0c1e | |||
a9feafeab3 | |||
bae832d65a |
33
README.md
33
README.md
@ -1,4 +1,4 @@
|
|||||||
# [Greenlock Express](https://git.rootprojects.org/root/greenlock-express.js) is Let's Encrypt for Node
|
# [Greenlock Express v4](https://git.rootprojects.org/root/greenlock-express.js) is Let's Encrypt for Node
|
||||||
|
|
||||||
| Built by [Root](https://therootcompany.com) for [Hub](https://rootprojects.org/hub/) |
|
| Built by [Root](https://therootcompany.com) for [Hub](https://rootprojects.org/hub/) |
|
||||||
|
|
||||||
@ -85,9 +85,11 @@ Works with _any_ node http app, including
|
|||||||
- [x] cluster
|
- [x] cluster
|
||||||
- [x] etc...
|
- [x] etc...
|
||||||
|
|
||||||
# QuickStart: Serve Sites with Free SSL
|
# v4 QuickStart
|
||||||
|
|
||||||
Easy as 1, 2, 3... 4
|
Serving sites with Free SSL is as easy as 1, 2, 3... 4
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
1. Create a Project with Greenlock Express
|
1. Create a Project with Greenlock Express
|
||||||
- `server.js`
|
- `server.js`
|
||||||
@ -99,6 +101,8 @@ Easy as 1, 2, 3... 4
|
|||||||
4. Hello, World!
|
4. Hello, World!
|
||||||
- `npm start -- --staging`
|
- `npm start -- --staging`
|
||||||
|
|
||||||
|
## 1. Create your Project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm init
|
npm init
|
||||||
npm install --save greenlock-express@v4
|
npm install --save greenlock-express@v4
|
||||||
@ -106,12 +110,14 @@ npm install --save greenlock-express@v4
|
|||||||
|
|
||||||
You can use **local file storage** or a **database**. The default is to use file storage.
|
You can use **local file storage** or a **database**. The default is to use file storage.
|
||||||
|
|
||||||
|
## 2. Initialize and Config (Dir or DB)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Note: you can use the CLI to create `server.js` and `greenlock.d/config.json`
|
||||||
npx greenlock init --config-dir ./greenlock.d --maintainer-email 'jon@example.com'
|
npx greenlock init --config-dir ./greenlock.d --maintainer-email 'jon@example.com'
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
`server.js`:
|
||||||
<summary>server.js</summary>
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -133,10 +139,7 @@ require("greenlock-express")
|
|||||||
.serve(app);
|
.serve(app);
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
`app.js`:
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>app.js</summary>
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -150,14 +153,14 @@ var app = function(req, res) {
|
|||||||
module.exports = app;
|
module.exports = app;
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
### 3. Add Sites
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Note: you can use the CLI to edit the config file
|
||||||
npx greenlock add --subject example.com --altnames example.com
|
npx greenlock add --subject example.com --altnames example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
`greenlock.d/config.json`:
|
||||||
<summary>greenlock.d/config.json</summary>
|
|
||||||
|
|
||||||
<!-- TODO update manager to write array rather than object -->
|
<!-- TODO update manager to write array rather than object -->
|
||||||
|
|
||||||
@ -165,9 +168,10 @@ npx greenlock add --subject example.com --altnames example.com
|
|||||||
{ "sites": [{ "subject": "example.com", "altnames": ["example.com"] }] }
|
{ "sites": [{ "subject": "example.com", "altnames": ["example.com"] }] }
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
### 4. Hello, Encrypted World!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Note: you can use npm start to run server.js with the --staging flag set
|
||||||
npm start -- --staging
|
npm start -- --staging
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -181,7 +185,8 @@ Listening on 0.0.0.0:443 for secure traffic
|
|||||||
|
|
||||||
## Walkthrough
|
## Walkthrough
|
||||||
|
|
||||||
Read the [WALKTHROUGH](https://git.rootprojects.org/root/greenlock-express.js/src/branch/master/WALKTHROUGH.md)
|
For a more detail read the full
|
||||||
|
[WALKTHROUGH](https://git.rootprojects.org/root/greenlock-express.js/src/branch/master/WALKTHROUGH.md).
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
@ -140,11 +140,12 @@ cat .greenlockrc
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# show the global defaults
|
# show the global defaults with the CLI
|
||||||
npx greenlock defaults
|
npx greenlock defaults
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// show the global defaults with the API
|
||||||
var defaults = await greenlock.defaults();
|
var defaults = await greenlock.defaults();
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -174,11 +175,12 @@ var defaults = await greenlock.defaults();
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# show per-site configs
|
# show per-site configs with the CLI
|
||||||
npx greenlock config --subject example.com
|
npx greenlock config --subject example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// show a site config with the API
|
||||||
greenlock.sites.get({ subject: "example.com" });
|
greenlock.sites.get({ subject: "example.com" });
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -213,11 +215,12 @@ You need to create a Let's Encrypt _subscriber account_, which can be done globa
|
|||||||
All individuals, and most businesses, should set this globally:
|
All individuals, and most businesses, should set this globally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set a global subscriber account
|
# Set a global subscriber account with the CLI
|
||||||
npx greenlock defaults --subscriber-email 'mycompany@example.com' --agree-to-terms true
|
npx greenlock defaults --subscriber-email 'mycompany@example.com' --agree-to-terms true
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// set a global subscriber account with the API
|
||||||
greenlock.manager.defaults({
|
greenlock.manager.defaults({
|
||||||
subscriberEmail: "mycompany@example.com",
|
subscriberEmail: "mycompany@example.com",
|
||||||
agreeToTerms: true
|
agreeToTerms: true
|
||||||
@ -230,11 +233,12 @@ A Let's Encrypt SSL certificate has a "Subject" (Primary Domain) and up to 100 "
|
|||||||
(of which the first _must_ be the subject).
|
(of which the first _must_ be the subject).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Add a certificate with specific domains
|
# Add a certificate with specific domains with the CLI
|
||||||
npx greenlock add --subject example.com --altnames example.com,www.example.com
|
npx greenlock add --subject example.com --altnames example.com,www.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
// Add a certificate with specific domains with the API
|
||||||
greenlock.sites.add({
|
greenlock.sites.add({
|
||||||
subject: "example.com",
|
subject: "example.com",
|
||||||
altnames: ["example.com"]
|
altnames: ["example.com"]
|
||||||
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@root/greenlock-express",
|
"name": "@root/greenlock-express",
|
||||||
"version": "4.0.1",
|
"version": "4.0.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -13,9 +13,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@root/acme": {
|
"@root/acme": {
|
||||||
"version": "3.0.8",
|
"version": "3.0.9",
|
||||||
"resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.0.9.tgz",
|
||||||
"integrity": "sha512-VmBvLvWdCDkolkanI9Dzm1ouSWPaAa2eCCwcDZcVQbWoNiUIOqbbd57fcMA/gZxLyuJPStD2WXFuEuSMPDxcww==",
|
"integrity": "sha512-/FgJF6RUrkqNpLmxqjktHaWMsLOwma6D+e4EBoxKtTjTAI+dBqW8Z8cH38feUsiIBR5LimPeYmBo/oqU3oMkKQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@root/encoding": "^1.0.1",
|
"@root/encoding": "^1.0.1",
|
||||||
"@root/keypairs": "^0.9.0",
|
"@root/keypairs": "^0.9.0",
|
||||||
@ -48,12 +48,12 @@
|
|||||||
"integrity": "sha512-OaEub02ufoU038gy6bsNHQOjIn8nUjGiLcaRmJ40IUykneJkIW5fxDqKxQx48cszuNflYldsJLPPXCrGfHs8yQ=="
|
"integrity": "sha512-OaEub02ufoU038gy6bsNHQOjIn8nUjGiLcaRmJ40IUykneJkIW5fxDqKxQx48cszuNflYldsJLPPXCrGfHs8yQ=="
|
||||||
},
|
},
|
||||||
"@root/greenlock": {
|
"@root/greenlock": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-4.0.3.tgz",
|
||||||
"integrity": "sha512-vurGBFlullzHM3STzQq00jWGCwvCYhpzusZZU69/80o4GPHB9OnUuxe/JlcokRZcCq+HqiVUeUJIBzPG086VWA==",
|
"integrity": "sha512-ocXz91v9LW3Y1OnEpZ3ExfW07CfxtdYfetsYaSXihMWWWOvy+tqWdn2lPIpEYrW9KoCmGj+ooqp44K0d+ZtsAg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@greenlock/manager": "^3.1.0",
|
"@greenlock/manager": "^3.1.0",
|
||||||
"@root/acme": "^3.0.8",
|
"@root/acme": "^3.0.9",
|
||||||
"@root/csr": "^0.8.1",
|
"@root/csr": "^0.8.1",
|
||||||
"@root/keypairs": "^0.9.0",
|
"@root/keypairs": "^0.9.0",
|
||||||
"@root/mkdirp": "^1.0.0",
|
"@root/mkdirp": "^1.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@root/greenlock-express",
|
"name": "@root/greenlock-express",
|
||||||
"version": "4.0.1",
|
"version": "4.0.2",
|
||||||
"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
|
"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
|
||||||
"main": "greenlock-express.js",
|
"main": "greenlock-express.js",
|
||||||
"homepage": "https://greenlock.domains",
|
"homepage": "https://greenlock.domains",
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"example": "examples"
|
"example": "examples"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@root/greenlock": "^4.0.2",
|
"@root/greenlock": "^4.0.3",
|
||||||
"redirect-https": "^1.1.5"
|
"redirect-https": "^1.1.5"
|
||||||
},
|
},
|
||||||
"trulyOptionalDependencies": {
|
"trulyOptionalDependencies": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user