gpt4 book ai didi

apache - Localhost - Xampp Mac 中的 OpenSSL

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

首先,我在终端上使用以下命令获得了 localhost.csr、localhost.key 和 localhost.crt:

要求:

openssl req -new -newkey rsa:2048 -nodes -keyout localhost.key -out localhost.csr 

证书:

openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt

我关注了这个问题 here并更新 httpd-ssl.conf 上的这些 directives 内容:

SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.key"
SSLCertificateFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.crt"

在 MyApache 中,启用了 SSL。当我重新启动 localhost 并转到 http://localhost 时,绿色标志出现但我得到:

Access Forbidden Error 403
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

如果我使用纯 http://localhost,网站加载正常。

请让我知道我的错误。我是 SSL 事物和指令的新手。

最佳答案

好吧,我终于想通了,必须将两个不同端口的虚拟主机设置为:

<VirtualHost localhost:80>
ServerName localhost
DocumentRoot "/Users/tikadattapahadi/web"
<Directory "/Users/tikadattapahadi/web">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>


<VirtualHost localhost:443>
SSLEngine on
ServerName localhost

SSLCertificateFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.crt"
SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.key"


DocumentRoot "/Users/tikadattapahadi/web/"
<Directory "/Users/tikadattapahadi/web/">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

关于apache - Localhost - Xampp Mac 中的 OpenSSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30520135/

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