如何使用让我们encryptiondynamicconfiguration的大容量虚拟主机

我有一台服务器configuration为使用Apach 2.4dynamicconfiguration虚拟主机。 我为某些域configuration了SSL,但我被要求使用Let's Encrypt免费服务为所有域提供SSL。

Certbot有点不清楚,因为我不确定它是否适用于dynamic虚拟主机。

我的挑战是我有一个子域subXXX.masterdomain.com和别名yourchoicedomain.com可用的每个域,所以我需要生成获取证书表单让我们encryption是有效的

  • subXXX.masterdomain.com
  • www.subXXX.masterdomain.com
  • yourchoicedomain.com
  • www.yourchoicedomain.com

我没有一个非常复杂的vhostsconfiguration文件,我使用符号链接来实现域别名和www服务器别名。

<VirtualHost *:80> #ServerName masterdomain.me #ServerAlias * # get the server name from the Host: header UseCanonicalName Off # include the server name in the filenames used to satisfy requests VirtualDocumentRoot "/var/www/vhosts/%0/httpdocs" RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS} off RewriteRule .* http://www.%{HTTP_HOST}$0 [R=301,L] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS} on RewriteRule .* https://www.%{HTTP_HOST}$0 [R=301,L] <Directory "/var/www/vhosts/*/httpdocs"> AllowOverride "All" Options SymLinksIfOwnerMatch Require all granted Order allow,deny Allow from all </Directory> </VirtualHost> 

任何帮助让我开始将是伟大的。

由于certbot无法确定您的Apacheconfiguration中的活动域名,所以您需要解决该问题。

由于mod vhost alias存在的子目录是什么“激活”的域名,我会build议一个简单的shell脚本枚举所有子目录(=所有活动域),然后运行certbot与--webroot选项来创build沿着行:

 certbot certonly --webroot -w var/www/vhosts/www.example.com/httpdocs -d www.example.com -d example.com -w var/www/vhosts/www.example.net/httpdocs -d www.example.net -d other.example.net 

Certbot需要目录名称和域名。 您可以根据他们的文档添加多达100个,并且不支持通配符。

您只需要将SSL相关configuration添加到虚拟主机别名(单个configuration文件),但是您可以对通过虚拟主机提及的所有域使用相同的证书。

仍然单个configuration文件可以为我工作。 试用和testing。