gpt4 book ai didi

apache - 在本地主机上启用 SSL 不适用于自定义端口

转载 作者:太空宇宙 更新时间:2023-11-03 14:33:46 24 4
gpt4 key购买 nike

我正在尝试在我添加的自定义端口 8040 (localhost:8040) 上启用 SSL,我遵循了 video教程来做到这一点

我有 xampp,我在 xampp\apache\bin 目录中执行了以下命令

下面是三个命令的顺序

openssl genrsa -aes256 -out private.key 2048

openssl rsa -in private.key -out private.key


openssl req -new -x509 -nodes -sha1 -key private.key
-out certificate.crt -days 36500 -config C:\xampp\apache\conf\openssl.cnf

现在我复制了生成的文件 private.keycertificate.crt 并将它们粘贴到这个目录 C:\xampp\apache\conf\key .

我在 httpd.conf 文件中取消了与 SSL 相关的行的注释
C:\xampp\apache\conf\extra

内的文件 httpd-ssl.conf

我添加了一个新目录

<VirtualHost *:8040>

DocumentRoot "C:/xampp/htdocs/laravel/public"
ServerName qa-staging.com
ServerAdmin admin@example
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"

SSLEngine on

SSLCertificateFile "C:/xampp/apache/conf/key/certificate.crt"

SSLCertificateKeyFile "C:/xampp/apache/conf/key/private.key"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/xampp/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>

BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0

CustomLog "C:/xampp/apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

但是当我尝试打开 https:\\localhost:8040 时,我得到了

This site can’t provide a secure connection

enter image description here

现在,如果我将 key 和证书目录添加到默认端口 443

当我请求 https:\localhost 时它工作正常

enter image description here

最佳答案

尝试在httpd.conf中添加“listen 8040”。

关于apache - 在本地主机上启用 SSL 不适用于自定义端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50067664/

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