简体   繁体   English

将SSL添加到Node.js端点:NGINX vs端点

[英]Add SSL to a Node.js endpoint: NGINX vs Endpoint

I need to add SSL to several Node.js services, each of one is listening on its own port, and that have NGINX to map them to our public "api" domain. 我需要将SSL添加到多个Node.js服务中,每个服务都在自己的端口上侦听,并且具有NGINX来将它们映射到我们的公共“ api”域。

Due to the release of a new security policy now all services must be enforced to only work on SSL connections. 由于发布了新的安全策略,因此现在必须强制所有服务仅在SSL连接上起作用。

Since I'm not used to work with SSL certificates it's not clear to me what can be the advantage of setting the SSL on NGINX and make NGINX itself to proxy-pass to a http:// connection or have the real node.js endpoint to be a SSL server and (then proxy-pass to https://). 由于我不习惯使用SSL证书,因此我不清楚在NGINX上设置SSL并使NGINX本身通过代理传递到http://连接或具有真正的node.js端点可能有什么好处。成为SSL服务器和(然后通过代理传递到https://)。

I guess with the NGINX solution, I could re-use the same SSL cert adding it to our "api" domain, while each different SSL node server would need a different cert. 我想使用NGINX解决方案,我可以重复使用相同的SSL证书,将其添加到我们的“ api”域中,而每个不同的SSL节点服务器都需要一个不同的证书。 Then it's not clear to me if into a production environment like this I should be using self-signed certificates (since the endpoint is touched through other services) or if it should be a CA trusted certificate exactly like it should be a public domain. 然后,对于进入这样的生产环境,我是否应该使用自签名证书(因为端点是通过其他服务来访问的),还是应该像完全属于公共领域一样,是受CA信任的证书?

What am I missing in this considerations? 我在考虑中缺少什么?

I assume the NGINX is public facing, and the nodejs services are internal (ie. not accessed directly by public web users). 我假设NGINX是面向公众的,而nodejs服务是内部的(即,公共Web用户不能直接访问)。

  1. You would only secure the connection between the public web to your NGINX. 只能保护公共网络与NGINX之间的连接。 The transport between the NGINX and the NodeJS services is internal, and doesn't need to be secured. NGINX和NodeJS服务之间的传输是内部的,不需要保护。 it's a big waste of CPU. 这是对CPU的极大浪费。

  2. For the NGINX you buy a certificate from a valid certificate authority. 对于NGINX,您可以从有效的证书颁发机构购买证书。 For internal services you may use self-signed (ie. your own internal certificate authority generated certificates), but as said above, you shouldn't need to use SSL internally. 对于内部服务,您可以使用自签名(即,您自己的内部证书颁发机构生成的证书),但是如上所述,您不需要在内部使用SSL。

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

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