大网数据广告活动
服务器运维问答

Virtual Host Forbidden after enabled SSL

· 52CE 我爱测

I enabled SSL for my wamp64 server and it all works fine for http://localhost/ and https://localhost/ . But I didn't enable it to look at localhost - I need to activate for 1 of my virtual hosts: <VirtualHost *:443> DocumentRoot …

问题原文

原帖链接 · Peon · CC BY-SA 3.0

I enabled SSL for my wamp64 server and it all works fine for http://localhost/ and https://localhost/.

But I didn't enable it to look at localhost - I need to activate for 1 of my virtual hosts:

<VirtualHost *:443>
    DocumentRoot "D:/DEV/www/app/public/"
    ServerName dev.app.com:443
    ServerAdmin admin@localhost
    ErrorLog "D:/wamp64/www/ssllogs/ssl_error.log"
    TransferLog "D:/wamp64/www/ssllogs/ssl_access.log"
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile "D:/wamp64/ssl.crt/server.crt"
    SSLCertificateKeyFile "D:/wamp64/ssl.key/server.key"

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>

    <Directory "D:/DEV/www/app/public">
        SSLOptions +StdEnvVars
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order deny,allow
        Allow from all
    </Directory>

    BrowserMatch ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    CustomLog "D:/wamp64/www/ssllogs/ssl_request.log" \
    "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

And of course it still has this in httpd-vhosts.conf

<VirtualHost *:80>
    ServerName dev.app.com
    DocumentRoot d:/dev/www/app/public
    <Directory  "d:/dev/www/app/public/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Now, the http version works just fine, but https gives me:

Forbidden

You don't have permission to access / on this server.
Apache/2.4.17 (Win64) OpenSSL/1.0.2h PHP/5.6.16 Server at dev.app.com Port 443

Any idea what's the problem?

已采纳解答

原帖链接 · Sum1sAdmin · CC BY-SA 3.0

<VirtualHost *:443> * matches everything - it's a wildcard

you shouldn't include the port inside the virtual host, you have already set that.

ServerName dev.app.com:443

should be

ServerName dev.app.com

You don't have permission to access / on this server. Apache/2.4.17 (Win64) OpenSSL/1.0.2h PHP/5.6.16 Server at dev.app.com Port 443

this is the result of a syntax error - syntax for Apache 2.4 has changed

Order deny,allow
Allow from all

becomes

Require all granted

see here for a full reference to access control syntax changes https://httpd.apache.org/docs/2.4/howto/access.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-05-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。