gpt4 book ai didi

apache - 在 Apache 中安装 SSL 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 13:02:20 25 4
gpt4 key购买 nike

我正在为 SSL 执行以下步骤:

openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.crt

这很好用。

openssl req -text -noout -verify -in domain.crt

效果不错。

openssl rsa -in domain.key -check

> RSA key ok writing RSA key
> -----BEGIN RSA PRIVATE KEY-----
>
>
> .....
>
>
> -----END RSA PRIVATE KEY-----

移动 .key.crt 文件到 /etc/apache2/ssl

打开/etc/apache2/sites-available/default-ssl.conf

添加

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/domain.crt
SSLCertificateKeyFile /etc/apache2/ssl/domain.key

接下来是

sudo a2enmod ssl

sudo service apache2 restart

错误是:

[Wed Jun 13 10:48:03.690496 2018] [ssl:emerg] [pid 2536] AH02562: Failed to configure certificate 172.31.25.100:443:0 (with chain), check /etc/apache2/ssl/domain.crt
[Wed Jun 13 10:48:03.690538 2018] [ssl:emerg] [pid 2536] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Wed Jun 13 10:48:03.690548 2018] [ssl:emerg] [pid 2536] SSL Library Error: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
AH00016: Configuration Failed

最佳答案

我建议您自动安装 ssl。你可以只通过一些代码来做到这一点:

sudo apt-get install git

git clone https://github.com/letsencrypt/letsencrypt

cd letsencrypt/

./letsencrypt-auto

在此之后,它会要求您接受条款以及是否要将所有流量从 http 重定向到 https。所以,你必须仔细阅读。

关于apache - 在 Apache 中安装 SSL 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50835630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com