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!

1 Answer 1


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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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