Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

<VirtualHost *:443>
 ServerName www.mydomain.com
 Redirect permanent / https://mydomain.com/
</VirtualHost>

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?

share|improve this question
    
You're running a redirection from port 443 to an https: site. What part of this isn't SSL-enabled? –  MadHatter Aug 30 '13 at 9:41

1 Answer 1

up vote 3 down vote accepted

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:

NameBasedSSLVHosts

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.

share|improve this answer
    
Ah, I see, that's the reason why it needs SSL enabled. I understand now. Thanks for the very clear explanation :) –  Question Overflow Aug 30 '13 at 10:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.