Apache SSL Error – Virtual Host Forbidden After Enabling SSL

apache-2.2apache-2.4

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?

Best Answer

<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

Related Topic