有关 Nginx 如何在 Google 计算引擎上使用 SSL 的详细信息

Details about how Nginx work with SSL on Google compute engine

我已成功将 spring 启动应用程序部署到 ubuntu 18.04 上的 Compute Engine,它位于 Nginx 代理之后,但目前 Nginx 正在侦听 80 端口,即 http。我需要设置安全连接。我对一些细节有疑问,我是新手,到目前为止我所做的只是在 windows、IDE 上编写 spring boot/react js 应用程序。

  1. 是否需要为我的计算引擎购买域,或者我可以为计算引擎的外部 ip 制作 SSL?在计算上 engine 只有后端 rest api 已部署,前端已开启 Netlify,它已经在工作了。我不需要好听的 后端的域名,因为用户不会看到它,只有前端 应用程序将使用我的计算引擎的 外部 ip 来获取数据 来自后端。
  2. 我看到教程在Nginx的设置里设置了SSL,为什么?请求不是先到计算引擎的 外部 ip 然后才到 Nginx 吗?计算引擎的工作不是通过向前端发送 public 密钥和证书来进行安全连接,然后 然后 将请求中继到 Nginx 吗?还是计算引擎只是立即将发送给它的 https 请求中继到 Nginx,而不保护 it/doing 任何密钥和证书发送?

如果您有任何建议,可以提供一些建议,我只是想与我的后端 spring 启动应用程序建立安全连接,该应用程序位于 google 计算引擎上的 Nginx 之后,它目前仅适用于 HTTP 但不适用于 HTTPs。

1。从技术上讲,您可以获得 public IP 的 SSL 证书,但很少使用。您可以在 RFC 5280 and in this question.

中找到更多详细信息

请记住,如果您的 IP 地址更改,您的 SSL 证书将变得无用

我检查了一些 SSL 提供商,发现您应该是 IP 的所有者才能获得此类 SSL 证书:

If you decide that you really need an IP in your cert there are specific stipulations, conditions, and limitations to consider. The biggest hurdle for most folks is that the IP address must be specifically assigned to your company or organization (not your ISP or hosting provider) as verified by an IP WHOIS lookup.

Quite frequent question: is it possible to issue an SSL certificate for an IP address (and not for a domain name)? Yes, it is possible. However, there are several requirements:

  • Only OV SSL certificates can be issued;
  • The company must own IP address (validation based on WHOIS information of IP-addresses).

An IP address SSL certificate secures connections directly with the IP address submitted. Whereas typically an SSL certificate is issued to a Fully Qualified Domain Name (FQDN), some organisations may need to secure an IP address.

Only public IP addresses may be used and you must be the owner of the IP address according to the records at RIPE.

因此,实际上,在 GCE VM 实例的情况下,这几乎是不可能的,并且更容易继续使用域证书。

2。在 GCE 中,所有到 VM 实例外部 IP 的连接都直接传递到 VM 实例。 GCE 无法自行保护连接。您应该在 VM 实例上配置 SSL 证书。您可以在文档 VPC network overview and IP Addresses.

中找到更多详细信息

此外,您还可以使用 Google-managed SSL certificates or own SSL certificates on external HTTP(S) load balancers