简体   繁体   English

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

[英]How can I add an SSL certificate to my already existing node.js server?

I have a node.js server made with keystone.js, but before launching it I need to add an SSL certificate. 我有一个用keystone.js制作的node.js服务器,但是在启动它之前,我需要添加一个SSL证书。 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. 我看到的所有将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上工作?

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端点,并将请求转发给您的节点进程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM