azure - 将 SSL 绑定(bind)到 Azure 容器实例

标签 azure ssl azure-container-instances azure-container-registry

我已经创建了节点 js api 并使用注册表将其托管在 Azure 容器实例中。我正在通过 FQDN 使用我的 API。现在我想将 SSL 证书绑定(bind)到这个实例。有什么办法吗?我搜索了解决方案,但没有找到。

最佳答案

您可以创建一个容器组,其中包含一个应用程序容器和一个运行 SSL 提供程序的边车容器。

根据 this document ,你会做这些:

  • > Create a self-signed certificate .对于生产场景,您应该从证书颁发机构获得证书。
  • 配置 Nginx 以使用 SSL。您为 Nginx 创建配置文件以使用 SSL。对 Nginx 配置文件、SSL 证书和 SSL key 进行 Base64 编码。然后,在用于部署容器组的 YAML 文件中输入编码内容。
  • > Deploy container group通过在 YAML 文件中指定容器配置。

例如,您可以编辑以下 YAML 文件以满足您的要求。

api-version: 2018-10-01
location: westus
name: app-with-ssl
properties:
  containers:
  - name: nginx-with-ssl
    properties:
      image: nginx
      ports:
      - port: 443
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
      volumeMounts:
      - name: nginx-config
        mountPath: /etc/nginx
  - name: my-app
    properties:
      image: mcr.microsoft.com/azuredocs/aci-helloworld
      ports:
      - port: 80
        protocol: TCP
      resources:
        requests:
          cpu: 1.0
          memoryInGB: 1.5
  volumes:
  - secret:
      ssl.crt: <Enter contents of base64-ssl.crt here>
      ssl.key: <Enter contents of base64-ssl.key here>
      nginx.conf: <Enter contents of base64-nginx.conf here>
    name: nginx-config
  ipAddress:
    ports:
    - port: 443
      protocol: TCP
    type: Public
  osType: Linux
tags: null
type: Microsoft.ContainerInstance/containerGroups

关于azure - 将 SSL 绑定(bind)到 Azure 容器实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59103334/

相关文章:

ssl - SSL证书中的sct列表是什么?

python - SSL 错误握手错误 10054 "WSAECONNRESET"

azure - 无法连接到容器实例控制台 websocket 已关闭或无法打开

Azure 容器实例传出 IP 范围

azure - 一个固定 IP 上的多个 Azure 容器实例组

visual-studio - Azure Key Vault - 在 PowerShell 脚本中删除 key

azure - 授权 Azure 订阅创建新版本定义时出错

Azure Application Insights 警报、自定义事件和 Docker

c# - 从另一个 Azure Function 启动 Azure Function 的最佳实践

json - 在 Google App Engine 上将 JSON 发送到 HTTPS 不起作用