MacOS 上の仮想ホストの SSL を取得する (Apache)

MacOS 上の仮想ホストの SSL を取得する (Apache)

私はApacheを実行しているMac OS Big Surホストを持っています。いくつかの仮想ホストを設定しました。次に、SSLを有効にして、ローカルサイトにアクセスできるようにします。https://example.local

私は 3 時間以上この問題を調べていますが、1 つのチュートリアルも機能していないようです。

これチュートリアルの例: ステップ 2 で次のエラーが発生します。

unable to load Private Key
4781444780:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-56.60.2/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: ANY PRIVATE KEY

ただし、server.key はディレクトリ内にあります。

私も試してみましたこのチュートリアルではCertbotを使用しますただし、Certbot にはパブリックにアクセス可能なドメインが必要ですが、ローカルの仮想ホストは当然パブリックではありません。

私が試した別のコマンドはここは:

openssl req -x509 -out localhost.crt -keyout localhost.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=example.local' -extensions EXT -config <( \
   printf "[dn]\nCN=example.local\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:example.local\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

次に、vhost ファイルを次のように構成しました。

<VirtualHost *:443>
    DocumentRoot "/Users/Niel/Sites/example/"
    ServerName example.local

    SSLEngine on
    SSLCertificateFile "/Users/niel/.config/letsencrypt/localhost.crt"
    SSLCertificateKeyFile "/Users/niel/.config/letsencrypt/localhost.key"

    <Directory "/Users/Niel/Sites/example/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

これにより、次のエラーが発生します/var/log/apache2/error_log

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[Tue Dec 29 00:15:13.939507 2020] [ssl:warn] [pid 68986] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib/php/extensions/no-debug-non-zts-20180731/zip.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/zip.so, 9): image not found), /usr/lib/php/extensions/no-debug-non-zts-20180731/zip.so.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/zip.so.so, 9): image not found)) in Unknown on line 0
[Tue Dec 29 00:15:14.145551 2020] [mpm_prefork:notice] [pid 68986] AH00163: Apache/2.4.46 (Unix) LibreSSL/2.8.3 PHP/7.3.24-(to be removed in future macOS) configured -- resuming normal operations
[Tue Dec 29 00:15:14.145632 2020] [core:notice] [pid 68986] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Dec 29 00:19:41.205429 2020] [authz_core:error] [pid 69057] [client 127.0.0.1:58915] AH01630: client denied by server configuration: /Users/Niel/Websites

とにかく、私は何千ものことを試しましたが、どれもうまくいきませんでした。MacOS で Apache を使用して仮想ホストで SSL を取得するにはどうすればよいでしょうか?

関連情報