如何在 Apache 2.4 (Windows 7) 上配置 SSL?

How to configure SSL on Apache 2.4 (Windows 7)?

我正在尝试在我的电脑上安装和配置 Apache 2.4 (Windows 7)。

我还需要 PHP 和 SSL。

使用 http 和 php 一切正常,但我使用 https 时遇到一些问题。

我在网上搜索了一些教程并找到了这个:http://www.silverwareconsulting.com/index.cfm/2009/3/31/Enabling-SSL-on-Apache-on-Windows

在我的 httpd-vhosts.conf 文件中,我创建了两个虚拟主机定义....

<VirtualHost *:80>
  ServerAdmin webmaster@dummy-host.example.com
  DocumentRoot "D:/Cesare/Personale/DocumentRootApache"
  ServerName localhost
  ServerAlias localhost
  ErrorLog "logs/localhost.com-error.log"
  CustomLog "logs/localhost-access.log" common    
  <Directory "D:/Cesare/Personale/DocumentRootApache">
   Options Indexes FollowSymLinks
   AllowOverride All
   Require all granted
  </Directory>    
</VirtualHost>

<VirtualHost *:443>
   SSLEngine on
   SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
   SSLCertificateFile "D:/Programmi/ApacheSoftwareFoundation/Apache24/conf/ssl/cesare.cert"
   SSLCertificateKeyFile "D:/Programmi/ApacheSoftwareFoundation/Apache24/conf/ssl/cesare.key"
   ServerAdmin webmaster@dummy-host.example.com
   DocumentRoot "D:/Cesare/Personale/DocumentRootApacheHttps"
   ServerName localhost
   DirectoryIndex index.html, index.cfm, index.php
   ErrorLog "logs/localhost.com-error.log"
   CustomLog "logs/localhost-access.log" common
   <Directory "D:/Cesare/Personale/DocumentRootApacheHttps">
    Options All
    AllowOverride All
   </Directory>
</VirtualHost>

所有目录都存在于我的电脑上,我已经检查过了。

当我尝试使用 url

访问时
https://localhost/index.html

响应是

Forbidden

You don't have permission to access /index.html on this server.

有什么建议吗?如果需要,我可以提供有关我的 apache 配置的其他信息。

提前致谢

由于权限而不是由于 SSL/TLS 错误,您无法获取该文件这一事实表明这不是 HTTPS 设置错误。

我建议您需要添加:

Require all granted

到您的 443 虚拟主机的目录配置,以允许访问此目录。你的 80 虚拟主机上有这个。