如何将SSL证书添加到我现有的node.js服务器?

时间:2023-01-22 16:36:22

I have a node.js server made with keystone.js, but before launching it I need to add an SSL certificate. All the examples and tutorials I've seen to add an SSL certificate to a node.js server only show how to create a new https server from scratch.

我有一个用keystone.js制作的node.js服务器,但在启动它之前我需要添加一个SSL证书。我看到将所有SSL证书添加到node.js服务器的示例和教程仅显示如何从头创建新的https服务器。

I already have my entire application and api working off http, is there a simple way to make it all work on https?

我已经拥有了我的整个应用程序和api正在使用http,是否有一种简单的方法可以在https上完成所有工作?

1 个解决方案

#1


0  

I'm not sure why you think you need to do this without restarting the application; it's a pretty low cost thing to do.

我不确定为什么你认为你需要这样做而不重新启动应用程序;这是一个非常低成本的事情。

That said, the simplest approach would be to put up an Nginx web server in front of it, and then setup the Nginx server as the https endpoint and proxypass the requests forward to your node process.

也就是说,最简单的方法是在它前面放置一个Nginx Web服务器,然后将Nginx服务器设置为https端点,并将请求转发给您的节点进程。

#1


0  

I'm not sure why you think you need to do this without restarting the application; it's a pretty low cost thing to do.

我不确定为什么你认为你需要这样做而不重新启动应用程序;这是一个非常低成本的事情。

That said, the simplest approach would be to put up an Nginx web server in front of it, and then setup the Nginx server as the https endpoint and proxypass the requests forward to your node process.

也就是说,最简单的方法是在它前面放置一个Nginx Web服务器,然后将Nginx服务器设置为https端点,并将请求转发给您的节点进程。