使用SSL时,在WAMP服务器上获取403禁止错误

Gar*_*rry 6 ssl wamp wampserver

我刚刚花了4个小时试图在我的本地开发wamp服务器上运行SSL(Windows 7).

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

当我尝试通过HTTPS(SSL 443)访问我的网站时,我似乎无法解决的唯一问题是403被禁止.它在端口80上工作正常,而不是在443上.错误日志显示以下内容

[error] [client 127.0.0.1] client denied by server configuration: F:/My Webs/freedate/public_html/
Run Code Online (Sandbox Code Playgroud)

我的http.conf文件添加了以下vhost

<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>
Run Code Online (Sandbox Code Playgroud)

我的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 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>
Run Code Online (Sandbox Code Playgroud)

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

亲切的问候加里

Pla*_*cid 6

尽管这是一个非常老的问题,但是我今天遇到了同样的问题,并且在此为将来遇到此问题的任何人提供解决方案。

如果一切都没有SSL,则此解决方案应该可以工作。您可以在这里找到无需SSL的帮助:https : //stackoverflow.com/a/14671738/2407971

httpd-ssl.conf文件中,在<VirtualHost _default_:443></VirtualHost>代码块之间,您会发现以下内容:

<Directory "c:/Apache24/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
Run Code Online (Sandbox Code Playgroud)

在这些行之后,插入以下代码:

<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>
Run Code Online (Sandbox Code Playgroud)

基本上,这将允许使用SSL访问www文件夹的根目录和yoursite。

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

希望能帮助到你。