我已经创建了节点 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/