ドメイン名を購入せずに apache2 で HTTPS を設定する

ドメイン名を購入せずに apache2 で HTTPS を設定する

Debian 9 Stretch (Raspberry なので Raspian) で apache2 を使用してサイト (2 つの仮想ホスト、同じドメインに別のサイトがあります) を正常に作成しました。

次のパスに保存されています: /var/www/html/www.mysite.ddns.net/www/。次のリンクからアクセスできます:mysite.ddns.net

今、https接続を設定したいので、Let's Encryptを使用してみました。サートボット

残念ながら、コマンドを実行するとsudo certbot --apache、次のエラーが発生します。

Obtaining a new certificate
Performing the following challenges:
Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA.
Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA.

問題はどこだ?

答え1

certbot --apacheサイトの URL が Apache で使用しているルート ディレクトリと正確に一致していないため、自動モードが機能しない可能性があります。

1 つのオプションは、証明書に使用されるドメイン名と Web サーバーのルート ディレクトリを手動で指定することです。

certbot certonly --webroot -w /var/www/html/www.mysite.ddns.net/www/ -d mysite.ddns.net

このコマンドは、/var/www/html/www.mysite.ddns.net/www/Web サーバーのルート ディレクトリとして を使用します。Certbot は、一時ファイル (ドメイン名に固有のもの) を という名前でディレクトリに配置し.well_known、 でそれらのファイルを読み取ろうとしますhttp://mysite.ddns.net/.well_known。これらのファイルが見つかると、証明書が付与されます。

証明書ファイルは に配置されます/etc/letsencrypt/live/mysite.ddns.net/

これらの証明書を使用するように Apache を構成するには、次のようにして Apache サイト構成に証明書を追加します。

SSLEngine on
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.ddns.net/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/mysite.ddns.net/fullchain.pem

a2enmod sslApache の SSL モジュールが有効になっていることを確認するためにも必ず実行してください。

Certbotの例は他にもいくつかあります。ユーザーガイド

関連情報