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

发布于 2025-01-01 03:23:47 字数 1586 浏览 1 评论 0原文

我刚刚花了 4 个小时试图让 SSL 在我的本地开发 wamp 服务器(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/

我的 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>

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

亲切的问候 加里

I have just spent the last 4 hours trying to get SSL working on my local devolopment wamp server (windows 7).

Everything seems to be setup ok now, well the server restarts without any errors at least!!

The only issue I can not seem to solve is a 403 forbidden when I try to access my site through HTTPS (SSL 443). It works fine on port 80, just not on 443.
The error log shows the following

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

My http.conf file has the following vhost added

<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>

And my httpd-ssl.conf has the following vhost added

<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>

If anyone can spot what I am doing wrong I would be most grateful, many thanks.

Kind regards
Garry

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再可℃爱ぅ一点好了 2025-01-08 03:23:47

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

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

httpd-ssl.conf 文件,位于 代码块,您会发现类似这样的内容:

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

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

希望有帮助。

Although this is a very old question, I faced the same issue today and I am giving the solution here for anyone facing this issue in the future.

This solution should work if everything is working without SSL. You can find help working without SSL here: https://stackoverflow.com/a/14671738/2407971

In the httpd-ssl.conf file, between the <VirtualHost _default_:443> and </VirtualHost> code blocks, you will find something like this:

<Directory "c:/Apache24/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

After these lines, insert the following code:

<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>

This will basically allow the root directory of the www folder and yoursite to be accessible in SSL.

Restart the server and test your site.

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文