Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.
/ certbot-express Public archive

simple and free http2 with express | 简单免费给express升级http2

Notifications You must be signed in to change notification settings

postor/certbot-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

certbot-express

simple and free http2 with express | 简单免费给express升级http2

prepare | 准备

if you are not using certbot, skip this | 如果你不使用certbot,跳过此步骤

certbot

install certbot

generate certification | 生成证书

point your domain to your server | 将域名指向要部署的服务器

certbot certonly

see full conversation here | 查看命令对话详情

install | 安装

npm install certbot-express

usage | 使用

const express = require('express')
const { redirect, http2 } = require('certbot-express')

const app = express()
const certDir = '/etc/letsencrypt/live/test.i18ntech.com/' // you can get certDir from env
const dev = process.env.NODE_ENV !== 'production'

app.use(redirect)
app.use('/', (req, res) => {
  res.send('http2!')
})

http2({
  dev,  //if dev is true only http is served, all about http2 are skipped
  certDir,
  app,
}).listen().then(() => {
  console.log('server started')
}).catch((e) => {
  console.log(e)
})

or | 或者

http2({
  keyPath:'/etc/letsencrypt/live/test.i18ntech.com/privkey.pem',
  certPath:'/etc/letsencrypt/live/test.i18ntech.com/fullchain.pem'
  app,
})

renew certification | 更新证书

it might be something like this, you can add it to your cron job

certbot renew --pre-hook "forever stop app.js" --post-hook "forever start app.js"

About

simple and free http2 with express | 简单免费给express升级http2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published