我如何用不同端口的单一ssl证书运行node js和apache?

58wvjzkj  于 2023-03-19  发布在  Apache
关注(0)|答案(1)|浏览(87)

我在端口号3000上使用nodejs,我的站点是ssl认证的。运行node server.js后,我得到了以下错误:
获取https://--.---.-.---:3000/socket.io/?EIO=3&transport=polling&t=1513323461271-0网络::错误连接被拒绝。
那么,我如何用不同端口的单一SSL证书运行node js和apache呢?而且我的网站托管在亚马逊服务器上。

vxf3dgd4

vxf3dgd41#

希望您已经在Apache中配置了SSL

节点(快速)

const express = require('express');
const app = express();
var cors = require('cors')
app.use(cors());
var server = require('http').createServer(app);

在服务器中打开httpd.conf并根据需要添加ProxyPass

ProxyPass /api/ http://localhost:3000/

不要忘记重新启动HTTP服务
http://www.example.com/mypageApachehttp:好的!
https://www.example.com/mypageApachehttps:好的!
http://www.example.com/api/节点http:好的!
https://www.example.com/api/节点https:很有效!!!

相关问题