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

This questions has been asked many times on StackOverflow but my question differs a bit :

I have multiple sub domain websites :

As you can see, only admin is served through https.

I successfully created all my virtual hosts in Nginx and this works well.

But now, I would like to redirect all the clients that tries to access to other sub websites via https to http :

=> only admin does the opposite.

My first thought was to set each https domain with a redirect :

server {
    listen 443;
    server_name www.example.com;

    rewrite         ^(.*)    http://www.example.com$1;
}

And did this for each subdomains (www, my and client).

But this don't work, I have an SSL error on my browser (SSL record too long).

How can I do that?

Thanks for your help!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need to include all the ssl stuff for nginx in the server {}

You need at least

            ssl                  on;
            ssl_certificate      /etc/ssl/domain.com.crt;
            ssl_certificate_key  /etc/ssl/domain.com.key;
share|improve this answer

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.