gpt4 book ai didi

apache - 如何在使用 MAMP 运行的 Apache 服务器中包含 SSL 证书文件

转载 作者:太空宇宙 更新时间:2023-11-03 15:08:54 32 4
gpt4 key购买 nike

我已经创建了 SSL 证书,以便为本地主机使用 https 而不是 http。我遵循的说明在这里:https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec

我还有最后一步,就是在服务器中包含证书文件(server.crt 和 server.key)。

我尝试依靠以下配置使其工作,我从中获得:How to install SSL certificate in apache server in ubuntu

LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
# maybe additional config here

ServerName www.example.com

SSLEngine on
SSLCertificateFile "/path/to/www.example.com.cert"
SSLCertificateKeyFile "/path/to/www.example.com.key"

</VirtualHost>

我目前在 Mac 上使用 MAMP,并使用 Apache 作为服务器。我编辑了位于 Applications/MAMP/conf/apache 中的文件 httpd.conf,并在文件底部添加了以下内容:

LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>

ServerName localhost:443

SSLEngine on
SSLCertificateFile "~/server.crt"
SSLCertificateKeyFile "~/server.key"

</VirtualHost>

请注意我的 SSL 文件位于 ~ 目录中。我还在这个文件中用443更新了8888个条目,它们是:

Listen 443
ServerName localhost:443

当我重新启动服务器时,它再次启动失败!

最佳答案

这是提供解决方案的视频:https://www.youtube.com/watch?v=886Pea2ljm0&t=2s

重要提示:如果从 MAMP 重新启动服务器时出现以下错误:

Apache couldn't be started. Please check your MAMP installation and configuration.

在终端上运行下面的命令就可以了:

sudo /Applications/MAMP/Library/bin/apachectl start

关于apache - 如何在使用 MAMP 运行的 Apache 服务器中包含 SSL 证书文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52024815/

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