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.

I would like to redirect domains on HTTP/HTTPS:

http://old.com -> https://new.com
https://old.com -> https://new.com

I have to specify the SSL key/certificate for the old domain but I'm not sure where I have to place these directives:

$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/pki/tls/private/new.com.pem"
ssl.ca-file = "/etc/pki/tls/certs/new.com.crt"
}

$SERVER["socket"] == ":80" {
  $HTTP["host"] =~ "old.com|new.com" {
    url.redirect = ( "^/(.*)" => "https://new.com:443/$1" )
  }
}

I was trying to add the code below but Lighttpd reports configuration errors:

$SERVER["socket"] == ":443" {
$HTTP["host"] =~ "old.com" {
url.redirect = ( "^/(.*)" => "https://new.com:443/$1" )
   }
ssl.engine = "enable"
ssl.pemfile = "/etc/pki/tls/private/old.com.pem"
ssl.ca-file = "/etc/pki/tls/certs/old.com.crt"

}
share|improve this question
    
What configuration errors are reported? Did you add a whole new $SERVER["socket"] == ":443" instead of modifying the existing one? –  Shane Madden Sep 22 '12 at 19:58

1 Answer 1

up vote 1 down vote accepted

You can't do that.

There can be only one certificate per port.

The possible solutions are:

  1. You get another IP address and specify the old certificate here.
  2. You get a multi domain certificate (which is valid for both the old and the new domain name).
share|improve this answer
1  
Actually, TLS Server Name Indication is supported in lighttpd. One of these days, there will be little enough Windows XP in the world that we'll be able to use it - but for the asker's needs, Windows XP support may be unneeded. –  Shane Madden Sep 22 '12 at 20:03
    
@ShaneMadden yes, somewhat true... However I would not deploy it today. –  cstamas Sep 23 '12 at 0:38

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.