Friday, November 2, 2018

Nginx - Redirect a bunch of domains to a single domain, with SSL





Nothing insidious going on but I've got a bunch of domains that we've bought for a service and I don't want to buy an SSL certificate for them all (there's about 11).



As an example, we've got:



example.com
thisisexample.com

ourexample.com
theexample.com


I have an SSL certificate for example.com and it is the main domain we're going to use. To protect our IP we've bought up a lot of similar domains and we're redirecting them all to example.com.



I've setup some redirects already and they're working fine on HTTP/80, both www and non-www.



However, accessing any of the domains on HTTPS/443 shows the privacy error.




Is there any way around this without having to buy lots of certificates? Can I not redirect https for one domain to another and allow that to terminate SSL?



EDIT:



My question is relating to Nginx, not Apache2.


Answer



Turns out I can avoid buying lots of SSL certificates via using LetsEncrypt for the domains I want to 301 redirect.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...