gpt4 book ai didi

apache - 启用 https 到 Xampp localhost

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

我正在尝试在我的本地设备上为本地主机启用 https,我进行了搜索,但没有任何效果。

我确保这些已启用:

httpd.conf中:

LoadModule ssl_module modules/mod_ssl.so

php.ini 中:

extension=php_openssl.dll

我将此添加到 httpd-vhosts.conf:

<VirtualHost _default_:443> 
DocumentRoot "C:/xampp/htdocs"
ServerName localhost:443
ServerAlias localhost:443
SSLEngine on
SSLCertificateFile "/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "/conf/ssl.key/server.key"
</VirtualHost>

我也试过:

SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"

但是我得到:

Your connection is not private
Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_AUTHORITY_INVALID

Subject: localhost

Issuer: localhost

Expires on: Nov 9, 2019

Current date: Oct 27, 2018

PEM encoded chain:
-----BEGIN CERTIFICATE-----
MIIBnzCCAQgCCQC1x1LJh4G1AzANBgkqhkiG9w0BAQUFADAUMRIwEAYDVQQDEwls
b2NhbGhvc3QwHhcNMDkxMTEwMjM0ODQ3WhcNMTkxMTA4MjM0ODQ3WjAUMRIwEAYD
VQQDEwlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMEl0yfj
7K0Ng2pt51+adRAj4pCdoGOVjx1BmljVnGOMW3OGkHnMw9ajibh1vB6UfHxu463o
J1wLxgxq+Q8y/rPEehAjBCspKNSq+bMvZhD4p8HNYMRrKFfjZzv3ns1IItw46kgT
gDpAl1cMRzVGPXFimu5TnWMOZ3ooyaQ0/xntAgMBAAEwDQYJKoZIhvcNAQEFBQAD
gYEAavHzSWz5umhfb/MnBMa5DL2VNzS+9whmmpsDGEG+uR0kM1W2GQIdVHHJTyFd
aHXzgVJBQcWTwhp84nvHSiQTDBSaT6cQNQpvag/TaED/SEQpm0VqDFwpfFYuufBL
vVNbLkKxbK2XwUvu0RxoLdBMC/89HqrZ0ppiONuQ+X2MtxE=
-----END CERTIFICATE-----



This server could not prove that it is localhost;
its security certificate is not trusted by your computer's operating system.
This may be caused by a misconfiguration or an attacker intercepting your connection.

以及在 httpd.conf 中将监听更改为 443

httpd.conf 中的 listen 编辑为 443 后,运行 apache 时出现错误:

 Diese Eingabeforderung nicht waehrend des Running beenden
Bitte erst bei einem gewollten Shutdown schliessen
Please close this command only for Shutdown
Apache 2 is starting ...
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : AH00072: make_sock: could not bind to address [::]:443

(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted. : AH00072: make_sock: could not bind to address 0.0.0.0:
443
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs

Apache konnte nicht gestartet werden
Apache could not be started
Press any key to continue . . .

怎么了?

最佳答案

起初您不必编辑文件httpd.conf 中的Listen 语句。你可以而且应该这样保留它:

Listen 80

您的其余配置看起来不错并且工作正常。您收到错误消息的问题或原因是因为您使用的是自签名证书。此自签名证书没有有效的授权机构(验证您的证书的公司)。

为了在本地系统上进行测试,这是绝对有效的。但是,如果您想强制您的浏览器(我可以从您发布的消息中看到您正在使用 Google Chrome) 信任您必须将自签名证书导入受信任证书列表的证书. @kellen 在此 post on SO 中发布了一个很好的教程.

关于apache - 启用 https 到 Xampp localhost,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53021881/

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