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



我刚刚花了4个小时试图让SSL在我的本地开发wamp服务器(windows7)上工作。

现在一切似乎都设置好了,服务器重新启动,至少没有任何错误!!

我唯一无法解决的问题是,当我试图通过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文件中添加了以下vhost

<VirtualHost *:80>
    ServerName www.freedate.local
    ServerAlias freedate.local *.freedate.local
    DocumentRoot "F:My Websfreedatepublic_html"
    <Directory "F:My Websfreedatepublic_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添加了以下vhost

<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 Websfreedatepublic_html"
    <Directory "F:My Websfreedatepublic_html">
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    DirectoryIndex index.html index.php
</VirtualHost>

如果有人能发现我做错了什么,我将不胜感激,非常感谢。

亲切问候Garry

虽然这是一个非常古老的问题,但我今天面临着同样的问题,我在这里为未来面临这个问题的任何人提供解决方案。

如果在没有SSL的情况下一切正常,则此解决方案应该可以工作。您可以在此处找到在没有SSL的情况下工作的帮助:https://stackoverflow.com/a/14671738/2407971

httpd-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文件夹的根目录和您的站点。

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

希望能有所帮助。

最新更新