多个子域的通配符SSL证书

时间:2018-08-10 05:19:27

标签: apache ubuntu https ssl-certificate wildcard-subdomain

我的系统有多个客户端。每个客户都有自己的子域。

client1.example.com
client2.example.com
...

在服务器端,所有请求都重定向到*.example.com然后,我的业务逻辑读取子域(如client1)并相应地对客户端进行响应。< / p>

因此,基本上,我配置服务器上的每个子域。我只是将其添加到我的数据库中,而我的代码可以正确处理它。

我正在尝试将通配符SSL证书应用于所有这些子域。另外,我希望所有将来的客户自动获得https

但是我不知道如何配置它。我尝试使用Let's Encrypt,但没有运气。实际的域example.com获取https,但没有客户端域。

任何有关配置的帮助将非常有帮助。 或者,可能是无法进行此设置。我不知道。

请帮助。

P.S。 example.com只是我所指的虚拟域。

P.P.S。我在Ubuntu 16.04 x64上使用apache2 Web服务器

1 个答案:

答案 0 :(得分:0)

嗯,有可能。我现在有一个*.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.

根据控制面板进行更改。

相关问题