APP打包网址ExpressJS 安源代码生成app装SSL证书,ExpressJS 环境配置https证书教程
ExpressJS 安装ssl需要对编码有点基础,购买证书后,下载nginx格式的证书 (解压后包含2个文件, key 私钥, cert 域名证书+根证书) |
//Test : curl -k https://localhost/
var express = require('express');
var https = require('https');
var http = require('http');
const fs = require('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/
部分内容来自网络投稿,如有侵权联系立删