ExpressJS 安装SSL证书,ExpressJS 环境配置https证书教程
ExpressJS 安装ss生成网站APPl需要对编码有点基础,购买证书后,下载nginx格式的证书 (解压后包含2个文件, key 私钥, cert 域名证书+根证书) |
//Test : curl -k https://localhost/
var express = require('express');
var https = require('https');
var http = require('http');
const fs = requapp生成器软件ire('fs');
const options = {
key: fs.readFileSync('path/yourdomain.com.key'),
cert: fs.readFileSync('path/yourdomain.com.crt')
};
var app = express();
http.createServer(app).listen(80);
https.createServer(options, app).listen(443);
编辑:娜娜,如若转载,请注明出处:https://www.yimenapp.com/kb-yimen/4897/
部分内容来自网络投稿,如有侵权联系立删