My server is working fine with a self-signed SSL certificate until I added the following lines to redirect request containing wwww
to non-www
site:
ServerName www.mydomain.com
Redirect permanent / https://mydomain.com/
The error I got is:
Server should be SSL-aware but has no certificate configured [Hint:
SSLCertificateFile] ((null):0)
I thought a simple redirection would not require SSL. What should be done to get this simple redirection to work?
Answer
The problem is that you cannot have multiple NameVirtualHost if you use SSL, that's a common problem with many different webservers.
The reason is in the network layers. HTTP is on top of SSL, this means that first the SSL connection has to be established, and then the HTTP request is sent. But the HTTP request decides which NameVirtualHost has to serve this request, at the same time SSL ceritificates can be specific to NameVirtualHosts, so how could the SSL connection be established if the NameVirtualHost to handle this request is not known yet at the time of the SSL handshake?
There are more people talking about this issue and suggesting workarounds. Like putting the different Virtual Hosts on different IPs or Ports, this would solve the issue because the IPs and Ports are known before the SSL connection has to be established:
On top of this, your VirtualHost is missing the SSL related directives like SSLEngine on
and the other SSL*
directives. I think that's probably the reason why you get this error, because you configured a VirtualHost without SSL to listen on port 443, while another VirtualHost on port 443 has SSL enabled. For the above described reason that can't work.
No comments:
Post a Comment