|
|
@ -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/) | |
|
|
|
|
|
|
@ -85,9 +85,11 @@ Works with _any_ node http app, including |
|
|
|
- [x] cluster |
|
|
|
- [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 |
|
|
|
- `server.js` |
|
|
@ -99,6 +101,8 @@ Easy as 1, 2, 3... 4 |
|
|
|
4. Hello, World! |
|
|
|
- `npm start -- --staging` |
|
|
|
|
|
|
|
## 1. Create your Project |
|
|
|
|
|
|
|
```bash |
|
|
|
npm init |
|
|
|
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. |
|
|
|
|
|
|
|
## 2. Initialize and Config (Dir or DB) |
|
|
|
|
|
|
|
```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' |
|
|
|
``` |
|
|
|
|
|
|
|
<details> |
|
|
|
<summary>server.js</summary> |
|
|
|
`server.js`: |
|
|
|
|
|
|
|
```js |
|
|
|
"use strict"; |
|
|
@ -133,10 +139,7 @@ require("greenlock-express") |
|
|
|
.serve(app); |
|
|
|
``` |
|
|
|
|
|
|
|
</details> |
|
|
|
|
|
|
|
<details> |
|
|
|
<summary>app.js</summary> |
|
|
|
`app.js`: |
|
|
|
|
|
|
|
```js |
|
|
|
"use strict"; |
|
|
@ -150,14 +153,14 @@ var app = function(req, res) { |
|
|
|
module.exports = app; |
|
|
|
``` |
|
|
|
|
|
|
|
</details> |
|
|
|
### 3. Add Sites |
|
|
|
|
|
|
|
```bash |
|
|
|
# Note: you can use the CLI to edit the config file |
|
|
|
npx greenlock add --subject example.com --altnames example.com |
|
|
|
``` |
|
|
|
|
|
|
|
<details> |
|
|
|
<summary>greenlock.d/config.json</summary> |
|
|
|
`greenlock.d/config.json`: |
|
|
|
|
|
|
|
<!-- 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"] }] } |
|
|
|
``` |
|
|
|
|
|
|
|
</details> |
|
|
|
### 4. Hello, Encrypted World! |
|
|
|
|
|
|
|
```bash |
|
|
|
# Note: you can use npm start to run server.js with the --staging flag set |
|
|
|
npm start -- --staging |
|
|
|
``` |
|
|
|
|
|
|
@ -181,7 +185,8 @@ Listening on 0.0.0.0:443 for secure traffic |
|
|
|
|
|
|
|
## 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 |
|
|
|
|
|
|
|