I want to redirect all traffic from old subdomain to new subdomain but something went wrong =)
Here is my config:
# Redirect from http to https server { listen 80 default deferred; # for Linux return 301 https://$host$request_uri; } # Redirect section - from old to new sub server { listen 80; listen 443 ssl http2; server_name old.domain.com www.old.domain.com; return 301 https://new.domain.com$request_uri; # should I use SSL while redirecting? without old certs nginx gives me an error... ssl_certificate ... ... } # main working subdomain server { listen 443 ssl http2; server_name new.domain.com www.new.domain.com; root ... ... }
With this config I can access to new.domain.com and it is working as expected with valid SSL cert, but old old.domain.com is also accessible without redirection :(
new.domain.com
old.domain.com
My variant is working, it was an error on DNS provider side (something was wrong with DNS records, CNAME)
1.4m articles
1.4m replys
5 comments
57.0k users