M
M
malike2016-03-27 00:25:50
Nginx
malike, 2016-03-27 00:25:50

How to write a condition in nginx to change everyone to https all but one host?

On server 1, a virtual host that processes all requests from *.domain.com
for all subdomains has a wilcard certificate, you need to throw everyone on https except for one subdomain
Tried like this but nginx swears

if ( $scheme = "http" ) {
       if ( $host != "subdomen.domain.com" ) {
               rewrite ^/(.*)$   https://$host/$1 permanent;
       }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question