S
S
Sergey2016-06-01 03:56:30
Nginx
Sergey, 2016-06-01 03:56:30

Nginx + ispconfig redirect to https, why does it redirect to ssl subdomain for which there is no host in nginx?

In general, there is a domain for example test.ru. There are domains qwe.test.ru and so on.
In ispconfig, I saw in the nginx directives for the site

location / {
if ($scheme = "http") {
        return 301 https://$server_name$request_uri;
}
}

On websites, everything works fine, but if, for example, there is no virtual host for asd.test.ru, then it redirects to some kind of website with ssl. How to deal with this? It can set listen 443 in default, but without ssl (but then there is an error in the browser - the browser is knocking on ssl). How to be?
As an option, add to the latest vhost nginx-a
if ($server_name != $host){
return 301 http://$server_name$request_uri;
}
. But do not rewrite it every time in the last host. We need a solution without crutches, ideally in nginx.conf and without errors with ssl because the certificate does not match the domain

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Chudnovsky, 2016-06-01
@Frankenstine

How to deal with this?

Reading documentation .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question