Answer the question
In order to leave comments, you need to log in
How to redirect from subdomain to nginx ssl domain?
Previously, the site had an account for authorized users on a separate subdomain https://subdomain.domain.ru , under ssl.
Now they issued a certificate only for the main domain, when moving, the following happens - access to https://subdomain.domain.ru is untrusted.
Everything is complicated by the fact that there are subdomains that should work without ssl on port 80. It is necessary to make a redirect from https://subdomain.domain.ru to https://domain.ru
using nginx so that there are no problems with the certificate.
This config does not work, although judging by the documentation it should
server {
listen 443 ssl;
server_name domain.ru *.domain.ru;
if ($host = subdomain.domain.ru) {
return 301 $scheme://domain.ru$request_uri;
}
...
server {
server_name subdomaun.domain.ru;
return 301 $scheme://domain.ru$request_uri;
}
server {
listen 443 ssl;
server_name domain.ru;
....
}
Answer the question
In order to leave comments, you need to log in
No way. Get a free certificate from startssl.com and do a normal redirect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question