I have a virtualhost directive that serves up a custom 404 error if invalid subdomain is entered:
<VirtualHost *:80> # the first virtual host ServerName site_not_found RedirectMatch 404 ^/(?!custom_error) </VirtualHost> <VirtualHost *:80> ServerName example.com ServerAlias ??.example.com </VirtualHost> I want to set up a virtualhost to show the same custom error via a HTTPS connection. I have tried the following:
<VirtualHost *:443> # the first virtual host ServerName site_not_found RedirectMatch 404 ^/(?!custom_error) </VirtualHost> <VirtualHost *:443> ServerName example.com ServerAlias ??.example.com # SSL options, other options, and stuff defined here. </VirtualHost> But the server would not start and an error is emitted:
Server should be SSL-aware but has no certificate configured [Hint: SSLCertificateFile] ((null):0)
It seems that an SSL certificate is required even if the SSLEngine is not turned on for this virtual host. Is there a way to get around the problem besides providing a cert? Turning off the module is not an option since I need SSL for the virtual server example.com.