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

标签 nginx ssl google-cloud-platform dns google-compute-engine

我已成功将我的 Spring Boot 应用程序部署到 Ubuntu 18.04 上的 Compute Engine,它位于 Nginx 代理之后,但当前 Nginx 正在监听 80 端口,即 http。我需要设置安全连接。我对一些细节有疑问,我对此很陌生,到目前为止我所做的只是在 IDE 中的 Windows 上编写 spring boot/react js 应用程序。

  • 必要为我的计算引擎购买一个域,或者我可以为 制作 SSL外网IP 计算引擎?在计算中
    engine 只部署了后端rest api,前端开启
    Netlify,它已经在工作了。我不需要好声音
    后端的域名,因为用户不会看到它,只有前端
    应用程序将使用 外网IP 我的计算引擎获取数据
    从后端。
  • 我在 Nginx 的设置中看到了设置 SSL 的指南,这是为什么呢?请求不是首先到达计算引擎的吗?外网IP 然后才到 Nginx ?通过将公钥和证书发送到前端和 来进行安全连接不是计算引擎的工作吗?只有这样 将请求转发给 Nginx ?还是计算引擎只是简单地将收到的 https 请求转发给 Nginx,而不对其进行保护/发送任何 key 和证书?

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

    最佳答案

    1 .从技术上讲,您可以拥有公共(public) IP 的 SSL 证书,但很少使用。更多详情请查看 RFC 5280在这个question .
    请记住 如果您的 IP 地址更改,您的 SSL 证书将变得无用 .
    我检查了一些 SSL 提供商,发现 您应该是 IP 的所有者才能获得此类 SSL 证书 :

  • 根据文章Using an IP Address in an SSL Certificate发表者geocerts :

  • 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.


  • 根据文章Issuing SSL certificate for an IP addressLeaderSSL :

  • 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).

  • 文章中相同 WHAT IS AN IP ADDRESS SSL CERTIFICATE? :

  • 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 中找到更多详细信息和 IP Addresses .
    此外,您还可以使用 Google-managed SSL certificates或拥有 external HTTP(S) load balancers 上的 SSL 证书.

    关于nginx - 有关 Nginx 如何在 Google 计算引擎上使用 SSL 的详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61913277/

    相关文章:

    regex - 基于 ngx.re.match() 添加自定义 header

    objective-c - 在 NSStream 上设置 SSL 或 TLS 安全

    ssl - 当我尝试从计算机自己的 ip 访问时,自签名 SSL 证书未在本地验证

    google-cloud-platform - 如何安排任务调用 gRPC 方法?

    google-cloud-platform - 在 GCP Deployment Manager 配置中使用 Stackdriver 资源组的 ID

    tomcat - nginx 转发到 tomcat 不工作

    django - AWS 中的静态文件配置不起作用

    nginx - 如何在 IBM Bluemix/Kubernetes 中为代理缓冲参数添加自定义 NGINX(入口)片段?

    java - 安装 SSL 证书 - 错误 DerInputStream.getLength() : lengthTag=94, 太大

    build - Google Cloud Build 与 Bitbucket 的集成