(Superseded) Redirect additional domain(s) to your Discourse instance

Update DNS Record

Update the A record for the domain(s) you want to redirect to original domain.

It helped and so am sharing. If somebody trying to change the A Record for the route domain. Don’t use * in the hostname but @ in the hostname of Digitalocean DNS management.

Why are you using digital ocean for DNS? It would be out recommendation to stick with your registrar’s DNS unless you’re looking to use specific features which require moving, such as Cloudflare or Route 53.

Not sure what’s the disadvantage of that. But the reason why i do it is using the registrar only for buying domain and leave that alone. Then manage everything in DO. Also their interface looks easy to manage multiple domains and setup.

Here’s my issue:

If I redirect my naked domain example.com → www.example.com using the instructions here, I have problems with my ssl certificate not being valid when going to example.com.

If I use NakedSSL to redirect example.com → www.example.com. My cookies and therefore topics read seems to not display accurately.

What is the solution? I am using a docker install on digital ocean.

@techAPJ @codinghorror

You must redirect to the “correct” form that you have certs for. Content cannot be at multiple domains simultaneously, that is a configuration error, and Google will ding you for duplicate content.

2개의 좋아요

Ok. I did get it working using the instructions as above. As you said my certificate probably hadn’t completely switched from the naked domain to the www domain.

However, I still have issues with discourse not remembering what I have read when I return to the root of the site. If I go straight to the root, all messages are shown as unread until I follow the latest and top links. Any idea what may be causing this behaviour?

Can someone please confirm these settings for me?

    - file:
        path: /etc/nginx/conf.d/www_redirect_1.conf
        contents: |
          server {
            listen 80;
            listen 443 ssl;
            server_name www.reddcointalk.org;
            return 301 https://reddcointalk.org$request_uri;
          }

The goal here is to redirect https://www.reddcointalk.org AND http://www.reddcointalk.org to https://reddcointalk.org. However, https://www.reddcointalk.org provides an SSL error. I’ve tried several different configurations of this but end up in the same place.

1개의 좋아요

I suppose it works fine for you now; as the links mentioned are redirecting fine. I suppose you had to specify ssl_certificate and ssl_certificate_key. Can you please share your updated settings?

I wanted the visitors of hotelbobbygg.xyz be forwarded to already working https://a.hotelbobbygg.xyz.

I’ve did exactly as you told. (app.yml shown below) and then rebuilt the image.

But visitors of hotelbobbygg.xyz get the certificate error (and can’t add exception either). I’ve even tried incognito mode.

I was wondering, in the path line (i.e. the line just next to ‘-file’), do I only need to give some name such as ‘some_name.conf’ or do I need to create that same named file ‘some_name.conf’ somewhere, under some /etc/path?

훌륭한 시작입니다. 그런데 제가 지금 겪고 있는 문제는, 도커 컨테이너 빌드에서 Let’s Encrypt가 루트 도메인(www 및 non-www)에 SSL 인증서를 발급하지 않기 때문에, 리다이렉트가 발생하기도 전에 브라우저에서 HTTPS 오류가 발생한다는 것입니다. 맞나요? 이 리다이렉트가 실제로 작동하도록 루트 도메인(www 및 non-www)에 SSL을 추가하는 방법은 무엇일까요?

Set up Let’s Encrypt with multiple domains / redirects - #24 를 확인해 보세요. 어제 이 방법을 사용하여 설정한 www.example.com 사이트에서 https://example.com을 올바르게 리디렉션하도록 구성했고, 예상대로 잘 작동했습니다.

2개의 좋아요

이 모든 내용이 2021년에도 여전히 유효한가요? 저는 오래된 URL을 새 호스트로 리디렉션하고 싶은데, 제 Discourse 설정은 https:// 사이트입니다. 여기 있는 지침들은 http:// 사이트(포트 80?)를 위한 것인 것 같습니다.
https://discourse.oldsite.com을
https://discourse.newsite.com으로 리디렉션하는 데 필요한 단계를 알려주시는 분이 있을까요?

DigitalOcean을 사용 중인데, 네트워크 설정에서 기존 사이트를 새 사이트로 가리키는 CNAME 레코드도 추가해야 할까요?

Let’sEncrypt 관련해서도 뭔가 처리해야 하나요?

도와주셔서 감사합니다!

링크된 토픽이 작동할 것입니다. 이 토픽은 app.yml에 몇 가지 설정을 추가하여 Let’s Encrypt가 두 서브도메인에 대한 인증서를 발급받도록 하는 방법을 설명합니다. 네, CNAME을 사용하거나 두 도메인이 모두 드롭렛으로 해석되도록 설정해야 합니다.

1개의 좋아요

빠른 답변 주셔서 정말 감사합니다.
그럼, 이전 게시물에 자세히 설명된 단계( 여러 도메인으로 Let’s Encrypt 설정하기 )만 수행하면 되고, OP의 내용은 하지 않아도 되는 건가요? (OP에는 포트 80만 언급되어 있습니다)

네. https://meta.discourse.org/t/setting-up-let-s-encrypt-with-multiple-domains/56685에 있는 것 하나만, 꽤 확신합니다.

시작할 때 DNS를 올바르게 설정하지 않으면 속도 제한(rate limit)에 부딪히게 됩니다.

3개의 좋아요

app.yml 파일에 이 블록을 추가했습니다.

after_web_config:
  - replace:
      filename: /etc/nginx/nginx.conf
      from: /sendfile.+on;/
      to: |
        server_names_hash_bucket_size 64;
        sendfile on;
  - file:
      path: /etc/nginx/conf.d/discourse_redirect_1.conf
      contents: |
        server {
          listen 80;
          server_name mydomain.tld2;
          return 301 $scheme://mydomain.tld1$request_uri;
        }
after_ssl:
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d mydomain.tld2 -d mydomain.tld2 --keylength"

현재 도메인 이름은 mydomain.tld1입니다. 재빌드 후 mydomain.tld1은 정상적으로 작동하지만, mydomain.tld2에 접근하려고 하면 ERR_CERT_COMMON_NAME_INVALID 오류가 발생하며, 그 반대도 마찬가지입니다(.yml 파일에서 tld1과 tld2를 교체해도).

누락된 설정이 있을까요?

1개의 좋아요

Let’s Encrypt 템플릿에서 무언가가 변경되었고, 다른 것이 추가로 필요하다고 생각합니다. 하지만 아직 시간을 내어 이를 완전히 디버깅하지는 못했습니다.

Digital Ocean를 통해 forum.mysite.ca에 Discourse 인스턴스를 설정했습니다. mysite.ca를 forum.mysite.ca로 리다이렉트하려고 했는데 작동하는 줄 알았는데, mysite.ca에 접속하면 다음과 같은 경고 메시지가 표시됩니다.

"Your connection is not private

Attackers might be trying to steal your information from mysite.ca (for example, passwords, messages, or credit cards). Learn more

NET::ERR_CERT_COMMON_NAME_INVALID"

그리고 “advanced” 버튼 안에 "Proceed to mysite.ca (unsafe)"라고 적힌 텍스트 링크가 있습니다.

약 일주일째 답을 찾고 있는데 많은 어려움을 겪고 있습니다. 조언이나 관련 링크가 있다면 알려주세요.

mysite.ca에는 자체 인증서가 있나요?

이 discourse/docs/INSTALL-cloud.md at main · discourse/discourse (github.com) 문서를 따랐는데, mysite.ca에 대해 인증서를 설정하지 않은 것 같습니다.