apache - 多个子域的通配符 SSL 证书
问题描述
我有一个有多个客户端的系统。每个客户端都有自己的子域。
client1.example.com
client2.example.com
...
在服务器端,所有请求都被重定向到*.example.com
. 然后我的业务逻辑读取子域(如client1
)并相应地响应客户端。
所以基本上,我不会在服务器上配置每个子域。我只是将它添加到我的数据库中,我的代码会正确处理它。
我正在尝试将通配符 SSL 证书应用于所有这些子域。另外,我希望所有未来的客户都能自动获得https
.
但我不知道如何配置它。我试过使用Let's Encrypt
,但没有运气。实际域example.com
获取https
但不是客户端域。
任何有关配置的帮助都会非常有帮助。或者,可能是,这种设置是不可能的。我不知道。
请帮忙。
PSexample.com
只是我指的一个虚拟域。
PPS 我在 Ubuntu 16.04 x64 上使用 apache2 网络服务器
解决方案
嗯,这是可能的。我现在有一个证书,*.example.com
它适用于我所有的任意子域,即,
client1.example.com
client2.example.com
...
我按照以下步骤操作:
$ wget https://dl.eff.org/certbot-auto
$ chmod a+x ./certbot-auto
$ sudo ./certbot-auto certonly \
--server https://acme-v02.api.letsencrypt.org/directory \
--manual --preferred-challenges dns \
-d *.example.com
然后使用在创建的文件/etc/letsencrypt/live/example.com/
,我从我的控制面板更新了值(我使用Vestacp
)
cat /etc/letsencrypt/live/example.com/cert.pem
^ Copy contents into “SSL Certificate” field.
cat /etc/letsencrypt/live/example.com/privkey.pem
^ Copy contents into “SSL Key” field.
cat /etc/letsencrypt/live/example.com/chain.pem
^ Copy contents into “SSL CA / Intermediate” field.
根据您的控制面板进行更改。
请按照本文了解详细步骤和说明。
推荐阅读
- python - 如何在 Visual Studio Code 上使用 python 海龟图形绘制递归 Sierpiński 箭头曲线
- javascript - Javascript数组搜索过滤器
- json - 从 JSON 制作模型类
- c# - C#:从字符串版本号中过滤诸如 `-beta1` 和 `hotfix` 之类的内容
- android - 在 Fragment 中获取相同的 ViewModel 实例,该实例在 Activity 中使用参数定义
- kubernetes - ELK docker GCP 安装
- angular - 重新加载页面时显示 Angular Material (8) 错误消息(来自验证器)
- oracle -
接收冲突。在同一进程中声明了类似的接收活动。oracle BPM 故障 - python - 为什么 file.write() 在末尾添加一个额外的字符串?
- google-chrome - Chrome SameSite=无;安全 Cookie 设置 - 您在第一方和第三方环境中访问的 Cookie