Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to rewrite https requests to https://www to https://. I'm trying to do something like this, but it doesn't seem to work for https:

server {
   listen 443;

   ssl on;
   ssl_certificate /etc/ssl/sslchain.crt;
   ssl_certificate_key /etc/ssl/domain.key;

   rewrite ^$request_uri permanent;
share|improve this question
What kind of error are you actually getting? – cjc Aug 25 '11 at 17:56
My certificate only works with the version of the URL so then Firefox has that certificate warning page saying the certificate isn't trusted... – johannix Aug 25 '11 at 18:26

If you are getting an SSL warning, you will need separate certs for and these are different entities, as far as the certificate is concerned (i.e., the server name must match the Common Name for the certificate exactly).

One option may be to use Subject Alternate Names, though, depending on the type of browsers you expect to visit your site, that may not work (i.e., mobile browsers may be more finicky). This essentially allows one certificate to be used for several different server names.

If you've already bought your cert, that may be a problem, too.

share|improve this answer
As stated I had to create/download another certificate for the www subdomain since I also had another subdomain that was using a different cert. – Keith Smiley Mar 7 '14 at 16:14

Your Answer


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.