やわらかしかっけい

なんでもすぐに忘れてしまう自分のために

Let's Encrypt 入れ直し+複数ドメイン

Let's Encrypt 入れた&自動更新設定してある。
他のドメインを追加したい。

→証明書取り直しが手っ取り早かった


d.hatena.ne.jp

ほぼこれ通りに。

certbot の部分は certbot-autoで

失効処理 参考

yoshinorin.net

certbot 入れ直し 参考

ajicolor.hatenablog.jp

certbot-auto 実行

./certbot-auto certonly --webroot -w /var/www/html/フォルダ1 -d ドメイン1.com  -w /var/www/html/フォルダ2 -d ドメイン2.com

こういうことだそうです

Webサーバ(Apache や nginx など)が動作している環境において、
複数のドメイン名に対応する1枚の証明書を取得する場合:
複数のドメイン名に対応する1枚の SSL/TLS サーバ証明書を取得する場合には、ドメイン名ごとに DocumentRoot が異なる場合があるため、それぞれのドメイン名に対応する DocumentRoot を個別に指定することができます。
複数のドメイン名を指定した場合、それぞれのドメイン名に対して、最後に指定した DocumentRoot --webroot-path (省略形 -w )が適用されます。
例えば、
certbot certonly --webroot -w /var/www/example/ -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net
と指定した場合、指定した全てのドメイン名(www.example.com, example.com, other.example.net, another.other.example.net)に使用可能な1枚の SSL/TLS サーバ証明書が発行されます。
ドメイン使用権者の認証の際には、ドメイン名 www.example.comexample.com に対しては DocumentRoot /var/www/example/ が使用され、ドメイン名 other.example.net と another.other.example.net に対しては DocumentRoot /var/www/other が使用されます。

https://letsencrypt.jp/usage/#ExecClientSoftware

実行する前に

使うドメインDNS設定とかをちゃんと済ませておくこと

vdeep.net

お名前.com で取ったドメインを使う

ひっかかりポイント

DNS レコードやAレコードに問題ありますよ・・・・」

みたいなエラーメッセージが出がち

.htaccess が原因だったので、
Basic認証HTTPSリダイレクトに関わる記述は全て取り除いておくこと!!

sole-color-blog.com

最後にVirtual Host

<VirtualHost *:443>
  ServerAdmin root@ドメイン3.com
  DocumentRoot /var/www/html/フォルダ3
  ServerName ドメイン3.com
<Directory "/var/www/html/フォルダ3">
AllowOverride All
</Directory>
  SSLEngine on
  SSLCertificateFile /etc/letsencrypt/live/ドメイン1.com/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/ドメイン1.com/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/ドメイン1.com/chain.pem
</VirtualHost>

1枚の証明書で複数のドメインを証明するので、
SSL証明書のありかはいずれも1つめのドメイン名のフォルダを指定する