使用SSL时在WAMP服务器上出现403禁止访问错误

7

我刚刚花了最近4个小时的时间在本地WAMP服务器(Windows 7)上尝试使SSL正常工作。

现在似乎一切都已经设置好了,至少服务器可以正常重启而没有任何错误!

唯一的问题是,当我尝试通过HTTPS(SSL 443)访问我的站点时出现403禁止访问的错误。 在端口80上运行良好,但在443上无法正常工作。 错误日志显示如下

[error] [client 127.0.0.1] client denied by server configuration: F:/My Webs/freedate/public_html/

我的http.conf文件中添加了以下虚拟主机:
<VirtualHost *:80>
    ServerName www.freedate.local
    ServerAlias freedate.local *.freedate.local
    DocumentRoot "F:\My Webs\freedate\public_html"

    <Directory "F:\My Webs\freedate\public_html">
        allow from all
        order allow,deny
        # Enables .htaccess files for this site
        AllowOverride All
    </Directory>
    DirectoryIndex index.html index.php
</VirtualHost>

我的httpd-ssl.conf文件中添加了以下虚拟主机配置:
<VirtualHost *:443>
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "C:/wamp/bin/apache/Apache2.2.21/conf/ssl/server.crt"
    SSLCertificateKeyFile "C:/wamp/bin/apache/Apache2.2.21/conf/ssl/server.key"

    ServerName www.freedate.local
    ServerAlias freedate.local *.freedate.local
    DocumentRoot "F:\My Webs\freedate\public_html"

    <Directory "F:\My Webs\freedate\public_html">
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    DirectoryIndex index.html index.php
</VirtualHost>

如果有人能指出我做错了什么,我将非常感激,非常感谢。
祝好, Garry
1个回答

12
尽管这是一个非常老的问题,但我今天遇到了同样的问题,在此为将来遇到此问题的任何人提供解决方法。
如果一切在没有SSL的情况下工作,那么这个解决方案应该有效。你可以在这里找到不使用SSL的帮助: https://dev59.com/weo6XIcBkEYKwwoYQiK7#14671738httpd-ssl.conf文件中,在<VirtualHost _default_: 443></VirtualHost>代码块之间,你会找到像这样的东西:
<Directory "c:/Apache24/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
在这些代码后面插入以下代码:
<Directory  "c:/wamp64/www/">
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
<Directory  "c:/wamp64/www/yoursite/">
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

这将基本上允许 SSL 访问 www 文件夹和您的站点的根目录。

重新启动服务器并测试您的站点。

希望它有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接