I have three sites running on a linode box. All have ssl certs. All have one with www and another without. In nginx, I have the configs setup to redirect from www to without. Everything is working as it should but, when you are on any of the sites and try adding in the address bar a www. in front of the name, it shows the site not secure page. If I click on the link to go to the site anyway, it shows one of the other sites instead, with the Not Secure in the address bar.
If I rename the config file of the site it wrongly took me to, it will take me to the next one and so on, all not secure.
I have tried changing the redirect to https instead of http, but that had no effect.
@Brian55, now please, paste you nginx conf (all server blocks) for your domains shopvacuk.com and www.shopvacuk.com because you are not configuring server block for port 443 and subdomain www.shopvacuk.com correctly.
So all the requests to http://shopvacuk.com http://www.shopvacuk.com https://www.shopvacuk.com would be redirected to https://shopvacuk.com
As you can see, I’ve added a new server block for www.shopvacuk.com which is configured to get its cert and privkey from /etc/letsencrypt/live/www.shopvacuk.com/ path (I hope that is the right path to the cert for your subdomain www.shopvacuk.com).
Hi sahsanu, Unfortunately I have found that there is still a problem. If I go to Firefox and enter www.shopvacuk.com, I get the Welcome to enginx page. This is the same on the other 2 sites as well. Is there another block needed?
@Brian55, I see no obvious error, /etc/nginx/conf.d/shopvacuk.com.conf is correct and /etc/nginx/conf.d/www.shopvacuk.com.conf.delete should not be loaded in nginx, it usually loads *.conf files, even if it were loaded, redirection should be performed.
Could you please restart nginx?.
If that doesn’t work I would need to review all your nginx conf so I will ask you to tar your nginx dir and send it to me privately.
Just for the records, the problem regarding subdomain www.shopvacuk.com not being redirected is because in the server conf I posted above, I wrote wwww.shopvacuk.com (4 w instead of 3 www.shopvacuk.com), so once the OP modify the subdomain with the right number of w letters the problem would be solved.