How to add ssl to non-www domain?

AI-generated summary

The user smth1 is seeking help to enable SSL on a non-www domain for their Discourse forum hosted on a VPS, with both www and non-www domains pointing to the same server. They’ve attempted to configure SSL via Let’s Encrypt in app.yml but it didn’t work. pfaffman suggests using forcewww.com as a workaround. Stephen recommends using Cloudflare’s page rules to redirect traffic, which smth1 implements, enabling Cloudflare’s SSL and setting up redirects for all domain variations to https://www.virtmach.com. However, they now face an SSL error, likely due to conflicting SSL configurations between Let’s Encrypt and Nginx. Stephen clarifies that the non-configured domain should be redirected via Cloudflare’s page rules, avoiding additional server-side changes.

Hello,

I have installed my forum on the www subdomain with the beginner setup.
I want to have ssl on non-www root domain, how can I add it via ssh?
www and non-www are A records to VPS where I have discourse installed.

Thanks!

btw.

I’ve added this advice to app.yml. Then rebuilded the app, still not working.

Don’t know why that didn’t work. I tihnk I’ve tested that lately, but see https://forcewww.com as a workaround.

You’re already using Cloudflare, so just set page rule to redirect the traffic?

Ok, I’ve enabled CDN on Cloudflare with their SSL.

Also I’ve made page rules:

http://virtmach.com => https://www.virtmach.com
http://www.virtmach.com => https://www.virtmach.com
https://virtmach.com => https://www.virtmach.com

Also, I’ve enabled “Always use HTTPS”.

Let’s see how it works.

Now I have this problem. I guess the Let’s Encrypt SSL and ngnix redirect should be disabled at server? Any tips?

Redirect whichever domain isn’t configured at Discourse using a Page Rule. No additional configuration on the Discourse server.