Search code examples
apacheconfigurationvirtualhost

SSL VirtualHost showing test page


I am using Apache httpd and have the following VirtualHost configuration:

<VirtualHost *:443>
    ServerName www.test.site
    ServerAlias test.site
    DocumentRoot /var/www/test.site/html
    ErrorLog /var/www/test.site/log/error.log
    CustomLog /var/www/test.site/log/requests.log combined
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/ca.crt
        SSLCertificateKeyFile /etc/pki/tls/private/ca.key

        <Directory /var/www/html>
                AllowOverride none

                Order Allow,Deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName www.test.site
    ServerAlias test.site
    DocumentRoot /var/www/test.site/html
</VirtualHost>

When entering http://test.site in my browser, I see what I want to see. However, https://test.site returns the Apache test page, even though I specified literally the same DocumentRoot.

What could be the reason? Thanks in advance.

I tried changing the VirtualHost configuration. I created new certificates, there are no errors with them.


Solution

  • Well, I finally found the problem. In the /etc/httpd/conf.d/ folder, there is an ssl.conf, which contains:

    <VirtualHost _default_:443>
    

    Deleting this, or changing default to 123.123.123.123, solves the problem, although it is arguably not an elegant solution.