mirror of
https://github.com/therootcompany/greenlock-express.js.git
synced 2024-11-16 17:28:59 +00:00
Compare commits
No commits in common. "cf93c77bd5c923af5a250e4f941e0e01b9b7c365" and "e6a008d498b009d2bf45443c05a67b1e644bf10b" have entirely different histories.
cf93c77bd5
...
e6a008d498
33
README.md
33
README.md
@ -1,4 +1,4 @@
|
|||||||
# [Greenlock Express v4](https://git.rootprojects.org/root/greenlock-express.js) is Let's Encrypt for Node
|
# [Greenlock Express](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,11 +85,9 @@ Works with _any_ node http app, including
|
|||||||
- [x] cluster
|
- [x] cluster
|
||||||
- [x] etc...
|
- [x] etc...
|
||||||
|
|
||||||
# v4 QuickStart
|
# QuickStart: Serve Sites with Free SSL
|
||||||
|
|
||||||
Serving sites with Free SSL is as easy as 1, 2, 3... 4
|
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`
|
||||||
@ -101,8 +99,6 @@ Serving sites with Free SSL is as 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
|
||||||
@ -110,14 +106,12 @@ 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'
|
||||||
```
|
```
|
||||||
|
|
||||||
`server.js`:
|
<details>
|
||||||
|
<summary>server.js</summary>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -139,7 +133,10 @@ require("greenlock-express")
|
|||||||
.serve(app);
|
.serve(app);
|
||||||
```
|
```
|
||||||
|
|
||||||
`app.js`:
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>app.js</summary>
|
||||||
|
|
||||||
```js
|
```js
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -153,14 +150,14 @@ var app = function(req, res) {
|
|||||||
module.exports = app;
|
module.exports = app;
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Add Sites
|
</details>
|
||||||
|
|
||||||
```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
|
||||||
```
|
```
|
||||||
|
|
||||||
`greenlock.d/config.json`:
|
<details>
|
||||||
|
<summary>greenlock.d/config.json</summary>
|
||||||
|
|
||||||
<!-- TODO update manager to write array rather than object -->
|
<!-- TODO update manager to write array rather than object -->
|
||||||
|
|
||||||
@ -168,10 +165,9 @@ npx greenlock add --subject example.com --altnames example.com
|
|||||||
{ "sites": [{ "subject": "example.com", "altnames": ["example.com"] }] }
|
{ "sites": [{ "subject": "example.com", "altnames": ["example.com"] }] }
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Hello, Encrypted World!
|
</details>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Note: you can use npm start to run server.js with the --staging flag set
|
|
||||||
npm start -- --staging
|
npm start -- --staging
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -185,8 +181,7 @@ Listening on 0.0.0.0:443 for secure traffic
|
|||||||
|
|
||||||
## Walkthrough
|
## Walkthrough
|
||||||
|
|
||||||
For a more detail read the full
|
Read the [WALKTHROUGH](https://git.rootprojects.org/root/greenlock-express.js/src/branch/master/WALKTHROUGH.md)
|
||||||
[WALKTHROUGH](https://git.rootprojects.org/root/greenlock-express.js/src/branch/master/WALKTHROUGH.md).
|
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
|
@ -140,12 +140,11 @@ cat .greenlockrc
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# show the global defaults with the CLI
|
# show the global defaults
|
||||||
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();
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -175,12 +174,11 @@ var defaults = await greenlock.defaults();
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# show per-site configs with the CLI
|
# show per-site configs
|
||||||
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" });
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -215,12 +213,11 @@ 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 with the CLI
|
# Set a global subscriber account
|
||||||
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
|
||||||
@ -233,12 +230,11 @@ 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 with the CLI
|
# Add a certificate with specific domains
|
||||||
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.2",
|
"version": "4.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -13,9 +13,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@root/acme": {
|
"@root/acme": {
|
||||||
"version": "3.0.9",
|
"version": "3.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@root/acme/-/acme-3.0.8.tgz",
|
||||||
"integrity": "sha512-/FgJF6RUrkqNpLmxqjktHaWMsLOwma6D+e4EBoxKtTjTAI+dBqW8Z8cH38feUsiIBR5LimPeYmBo/oqU3oMkKQ==",
|
"integrity": "sha512-VmBvLvWdCDkolkanI9Dzm1ouSWPaAa2eCCwcDZcVQbWoNiUIOqbbd57fcMA/gZxLyuJPStD2WXFuEuSMPDxcww==",
|
||||||
"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.3",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@root/greenlock/-/greenlock-4.0.2.tgz",
|
||||||
"integrity": "sha512-ocXz91v9LW3Y1OnEpZ3ExfW07CfxtdYfetsYaSXihMWWWOvy+tqWdn2lPIpEYrW9KoCmGj+ooqp44K0d+ZtsAg==",
|
"integrity": "sha512-vurGBFlullzHM3STzQq00jWGCwvCYhpzusZZU69/80o4GPHB9OnUuxe/JlcokRZcCq+HqiVUeUJIBzPG086VWA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@greenlock/manager": "^3.1.0",
|
"@greenlock/manager": "^3.1.0",
|
||||||
"@root/acme": "^3.0.9",
|
"@root/acme": "^3.0.8",
|
||||||
"@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.2",
|
"version": "4.0.1",
|
||||||
"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.3",
|
"@root/greenlock": "^4.0.2",
|
||||||
"redirect-https": "^1.1.5"
|
"redirect-https": "^1.1.5"
|
||||||
},
|
},
|
||||||
"trulyOptionalDependencies": {
|
"trulyOptionalDependencies": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user