Change the domain name or rename your Discourse

:bookmark: This guide explains how-to change the domain name of your Discourse site, and includes information about setting up DNS changes, editing configuration files, updating site settings, and correcting social logins and post content to reflect your new domain name.

:warning: This guide is for self-hosted Discourse instances that were installed using our installation guide on GitHub. If you are hosted by Discourse, please see Configure your domain name for hosted Discourse for specific instructions.

You may eventually want to change the domain name of your Discourse instance, from say

=BEFORE==AFTER=

Let’s get started.

Setting the DNS TTL low in advance

First, change the Time-To-Live (TTL) setting for your DNS to a low value like 60 minutes. This should be done days ahead of the actual domain change to ensure the change can propagate quickly across the internet.

Remove old domain name from any site settings

Visit /admin/site_settings in your Discourse admin interface, and search for any settings containing the old domain name. Update these settings to the new domain name.

Changing DNS Records

Update your DNS settings to disable the old domain and point the new domain to the IP address of your Discourse server.

Editing the site name in app.yml

You can edit the app.yml file manually to input the new domain information.

Here’s how to edit it manually:

cd /var/discourse
nano containers/app.yml

Locate the following line and replace it:

DISCOURSE_HOSTNAME: 'your.newdomain.com'

If using a Content Delivery Network (CDN), temporarily disable it by commenting out the respective line in app.yml. Rebuild your Discourse site with:

./launcher rebuild app

:information_source: Alternatively, you can run ./discourse-setup again and input the new domain information instead of editing app.yml.

Check that your site is operational under the new domain.

Fixing social logins

:exclamation: Depending on how you logged in, you may need to do this first or you won’t be able to log in once the name is changed.

If you use social logins, update the credentials on the platforms (Twitter, Facebook, Google, GitHub) to reflect the new domain. Look for guides on the Discourse how-to category.

Remapping domain names in posts

All the existing posts will still refer to the old domain.

You’ll need to change old domain references in your posts to the new domain:

./launcher enter app

then

discourse remap =BEFORE= =AFTER=

Finalize with:

rake posts:rebake

This ensures that the domain name remaps in existing posts, and content is regenerated as necessary.

:information_source: If you have a CDN, remember to reactivate it post-domain change.

wondering how we created that form?

Last edited by @SaraDev 2024-12-13T00:50:25Z

Check documentPerform check on document:
192개의 좋아요
Changing the subdomain
Changed Domains- Not getting redirects
Having an issue after changing domain
Great How To Guides
Put forum under sub-domain and have website
Our domain name changed, where do I edit the hostname?
Hosted-by-discourse.com .. how to configure / rebake / ssh?
Moving from one S3 bucket to another
WP Discourse - Relinking Comments After Moving Blog
Image links point to Incorrect (Previous) subdomain After Migration
Rename existing discourse site
Authentication and changing domain
Links broken after move
Unable to change domain name
Moving to subdomain
Got a strange error when I transferred our forum to the new server and new domain
Unable to change email address after switching domains
Avatars lost after restore. How to get them back?
Got a strange error when I transferred our forum to the new server and new domain
How to change URL associated with Activate Account button
Avatars lost after restore. How to get them back?
How might we better structure #howto?
Problem accessing plugin admin after restore
Unable to view all the images after updating to 3.4.0.beta1-dev
Migrate from AWS to Digital Ocean with 2 containers, spaces and 2 CDNs
Problem linking Discourse forum to WP Discourse
Site responds 502 Bad gateway - is it Ruby?
All internal links broken after restoring backup to new server
Set Up Let's Encrypt with Second Domain for Existing Discourse Install
Lost DNS Name, need to change to a new one
Questions about rebake
Cloned my DO discourse droplet, how to get clone to go to right domain?
Too many user emails domains not working lead to mailgun domain disabled: what to do?
I got example.com links. Where do they come from?
Problem linking Discourse forum to WP Discourse
Help changing domain
Onebox error code of 403
Move Discourse to a new server without setting up the web UI first?
Images not appearing after domain change
Can not save Default Watched Category/Tags
Images prior 2022 lost
Using external Domain in the browser address line
After activating HTTPS Discourse doesn´t work
504 Gateway error after launching new AWS instance
Adding www. to Domain
Unable to rebuild discourse due to no space left on device
Remap error when a post contains a quote from another topic
Attempted to switch mail provider, messed up my discourse
Changed domain of WordPress and Onebox
Can't reach site
Can't Reach Site (Take 2)
Admin panel messed up after changing the domain name
What I should know when changing the domain name of a discourse forum
Any ideas why my discourse can't show emoji and images?
Ghost hostname after hostname change
Changing hostname
Changing hostname
Rake:rebake crashes with errors: PG::ConnectionBad: PQsocket
Rebake fails when changing the subdomain name only
How to remove "Website Name" links shared in a topic/post?
How to change URL associated with Activate Account button
./launcher rebuild app for old 1.6 discourse not working
Error when I send a message in chat [downgraded to Stable from 3.1.0beta4]
Moving to Another VPS Provider
Changing domain and getting certificate for www
Some pictures don't display after a domain change
Customize direct-delivery Postfix configuration
Multiple hostnames for a single site for cut-over phase
Change domain and rebake post all image not show
Set up Let’s Encrypt with multiple domains / redirects
Error on attempting to remap links
Site super slow after migration
Resource/Advice on how to change domains?
Can I upload discourse backup file to different domain address?
Discourse version at f.example.LTD: NOT FOUND
Remap command issues
Force pdf download
What are the steps to test Discourse before switching domains
Remap failure when changing discourse domain
Remap failure when changing discourse domain
:cn: How to change the domain name | 如何修改 Discourse 的域名
Jump to main address automatically?
Migrate discourse from main domain --> subdomain
Uploads Path Should Update When URL Changes in app.yml During Container Rebuild
Change from example.com to community.example.com
Clone to a new server; Change Domain; New Topic Asking for Login Everytime
Attachments serving locally on the server but not publicly
Create self-hosting clean Incomplete cleaning
How much does changing the subdomain/domain break things?
Postgresql problem on moving discourse with rsync
Migrate a phpBB3 forum to Discourse
Image uploads used to work but no longer do after forum name change?
Can't regenerate Discourse ID credentials after changing domain name
Error running remap after changing site url
How to remove "Website Name" links shared in a topic/post?
Self-Hosting Discourse Just Got a Whole Lot Easier
Migrating from SMF to Discourse
After SSL installation pictures are not displayed
Bootstrap failed after rebuild - changed domain name
Nil usage errors in un-self-deleting posts
Effect of changing the WordPress site URL
How to determine performance bottleneck?
Changing discourse from domain to subdomain?
Switching forum from subdomain to sub directory
Creating a duplicate of production environment
Rename custom domain of hosted Discourse forum
Discourse none admin side not working returning error 500
Broken image URL paths after changing hostname
File URLs broken after moving to a different domain
How can I bulk remap/update user email addresses?
How can I bulk remap/update user email addresses?
I have a few questions before migrate from Xenforo 2.x to Discourse
Preparing test Installation -some questions
Re-Run Setup Discourse
How do I change the URL of my Discourse community
How to change the domain for Discourse?
Can I change the domain name - without a clean install?
Links broken after move
Moving from Vultr to DigtitalOcean
Missing avatars and site images after import of a backup
Discourse Install on Lightsail
Ssl_error_bad_cert_domain

There is really no reason for a rebake?
The remap already took care of mapping the old URL to the new URL.

6개의 좋아요

@SaraDev Thanks for keeping things tidy. Can you have a look at:

and

Maybe I am missing something but… If you use the ./discourse-setup method you will need to set the ip for the new domain prior to running ./discourse-setup to prevent the dreaded domain check failure, yikes.

Using the talk.foo.comtalk.bar.com convention

Hostname for your Discourse? [talk.foo.com]: talk.bar.com

Checking your domain name . . .
WARNING: Port 443 of computer does not appear to be accessible using hostname: talk.bar.com.
WARNING: Connection to http://talk.bar.com (port 80) also fails.

2개의 좋아요

Hi @philh,

Thanks for mentioning this:

This is correct, and if you run ./discourse-setup to and input the new domain information instead of editing app.yml you will need to setup the DNS records for your new domain first.

This information has updated this in the guide to reflect the correct order for updating the domain in this situation. :slightly_smiling_face:

1개의 좋아요

Thanks Sara!

BTW: I am pretty sure there is a domain check during rebuild running ./launcher rebuild app :wink: which would suggest dns should be updated 1st either way: direct edit of app.yml or ./discourse-setup

Thanks again for working to keep things tidy. Up to date instructions does help the newer folks that come along. :slight_smile:

2개의 좋아요

이걸 해보고 싶은데, 저는 Digital Ocean을 사용 중이고 전문가가 아닙니다. Digital Ocean에서 변경해야 할 사항이 있을까요?

예를 들어, 이런 것을 볼 수 있습니다:

하지만 이건 제가 지은 이름일 뿐이고, 실제 설정은 아닌 것 같습니다.

그러므로 이 페이지의 지시사항을 따르는 한, Digital Ocean에서 아무것도 변경할 필요가 없을 것 같습니다(혼동을 피하기 위해 이 이름을 새 도메인으로 업데이트하는 것 정도는 예외일 수 있겠죠).

새 사이트가 올바르게 작동하려면 도메인 이름 제공업체에서 DNS 설정을 업데이트해야 합니다.


예시:

이전 사이트가 다음과 같았다면:

forum.example.com → 1.1.1.1

다음으로 변경해야 합니다:

forum.newname.com → 1.1.1.1


서브도메인을 변경하나요, 아니면 전체 도메인을 변경하나요?

위 예시에서:

  • 도메인: example.com
  • 서브도메인: forum

서브도메인만 변경하는지, 아니면 전체 도메인 이름을 변경하는지에 따라 DNS 기록을 그에 맞게 업데이트하십시오.



:label: 서브도메인을 변경하나요, 아니면 전체 도메인을 변경하나요?

위 예시에서:

  • 도메인: example.com
  • 서브도메인: forum

서브도메인만 변경하는지, 아니면 전체 도메인 이름을 변경하는지에 따라 DNS 기록을 그에 맞게 업데이트하십시오.


:globe_with_meridians: DNS 설정 예시

:blue_circle: Cloudflare

  1. Cloudflare 대시보드에 로그인합니다.
  2. 도메인(예: example.com)을 선택합니다.
  3. DNS 탭으로 이동합니다.
  4. forum에 대한 기존 A 또는 CNAME 기록을 찾습니다.
  5. 편집합니다:
    • 이름: forum
    • 내용: 1.1.1.1 (또는 서버 IP)
  6. 저장을 클릭합니다.

:yellow_circle: GoDaddy

  1. GoDaddy 계정에 로그인합니다.
  2. 도메인을 클릭한 다음 도메인을 선택합니다.
  3. 추가 설정 아래에서 DNS 관리를 클릭합니다.
  4. 기록 섹션으로 스크롤합니다.
  5. forum에 대한 A 기록 또는 CNAME을(를) 찾아 편집 아이콘을 클릭합니다.
  6. 다음을 업데이트합니다:
    • 호스트: forum
    • 가리키는 대상: 1.1.1.1
  7. 저장을 클릭합니다.

:orange_circle: Namecheap

  1. Namecheap 계정에 로그인합니다.
  2. 도메인 목록으로 이동한 다음 도메인 옆의 관리를 클릭합니다.
  3. 고급 DNS 탭을 엽니다.
  4. 호스트 기록에서 forum이 포함된 항목을 찾습니다.
  5. 편집을 클릭하고 다음을 업데이트합니다:
    • 호스트: forum
    • : 1.1.1.1
  6. 변경 사항을 저장하려면 녹색 체크표시를 클릭합니다.

DNS 변경 사항은 제공업체와 TTL 설정에 따라 완전히 전파되는 데 몇 분에서 최대 48시간까지 걸릴 수 있습니다.

:three_o_clock: 참고: DNS 변경 단계는 AI를 사용하여 생성되었으며, 제공업체에 따라 달라지거나 오류가 있을 수 있습니다.

1개의 좋아요

제 문제는 실제로 DNS가 아니라 Digital Ocean와 관련된 것이었습니다. DNS는 Cloudflare에서 쉽게 변경할 수 있었죠. 결국 Digital Ocean에서 변경할 필요가 없음을 깨달았습니다.

어쨌든 답변해 주셔서 감사합니다!

1개의 좋아요