Discourseのドメイン名を変更または名前の変更

:bookmark: このガイドでは、Discourseサイトのドメイン名を変更する方法について説明します。これには、DNS変更の設定、設定ファイルの編集、サイト設定の更新、ソーシャルログインや投稿コンテンツの新しいドメイン名への修正に関する情報が含まれます。

:warning: このガイドは、GitHubのインストールガイドを使用してインストールされたセルフホスト型Discourseインスタンスを対象としています。Discourseによってホストされている場合は、特定の指示についてhttps://meta.discourse.org/t/configure-your-domain-name-for-hosted-discourse/21827を参照してください。

例えば、Discourseインスタンスのドメイン名を変更したい場合があります。

=BEFORE==AFTER=

始めましょう。

事前にDNSのTTLを低く設定する

まず、DNSのTime-To-Live(TTL)設定を60分などの低い値に変更します。これにより、変更がインターネット全体にすばやく伝播するように、実際のドメイン変更の数日前にこれを行う必要があります。

サイト設定から古いドメイン名を削除する

Discourse管理インターフェースの/admin/site_settingsにアクセスし、古いドメイン名を含む設定をすべて検索します。これらの設定を新しいドメイン名に更新します。

DNSレコードの変更

DNS設定を更新して、古いドメインを無効にし、新しいドメインをDiscourseサーバーのIPアドレスに向けるようにします。

app.ymlでサイト名を編集する

app.ymlファイルを手動で編集して、新しいドメイン情報を入力できます。

手動で編集する方法は次のとおりです。

cd /var/discourse
nano containers/app.yml

次の行を見つけて置き換えます。

DISCOURSE_HOSTNAME: 'your.newdomain.com'

コンテンツデリバリーネットワーク(CDN)を使用している場合は、app.yml内の対応する行をコメントアウトして一時的に無効にします。次のコマンドでDiscourseサイトを再構築します。

./launcher rebuild app

:information_source: あるいは、./discourse-setupを再度実行し、app.ymlを編集する代わりに新しいドメイン情報を入力することもできます。

新しいドメイン名でサイトが機能することを確認します。

ソーシャルログインの修正

:exclamation: ログイン方法によっては、これを最初に行う必要がある場合があります。そうしないと、名前変更後にログインできなくなる可能性があります。

ソーシャルログインを使用している場合は、新しいドメインを反映するように各プラットフォーム(Twitter、Facebook、Google、GitHub)の資格情報を更新します。Discourseのhow-toカテゴリでガイドを探してください。

投稿内のドメイン名の再マッピング

既存のすべての投稿は、引き続き古いドメインを参照しています。

投稿内の古いドメインへの参照を新しいドメインに変更する必要があります。

./launcher enter app

その後

discourse remap =BEFORE= =AFTER=

次のコマンドで最終確認を行います。

rake posts:rebake

これにより、既存の投稿でドメイン名が再マッピングされ、必要に応じてコンテンツが再生成されます。

:information_source: CDNを使用している場合は、ドメイン変更後に再度有効化することを忘れないでください。

:small: このフォームをどのように作成したか疑問に思われますか?

「いいね!」 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?
Moving to subdomain
Rename existing discourse site
Unable to change domain name
Links broken after move
Unable to change email address after switching domains
Authentication and changing domain
Got a strange error when I transferred our forum to the new server and new domain
Moving from one S3 bucket to another
WP Discourse - Relinking Comments After Moving Blog
Hosted-by-discourse.com .. how to configure / rebake / ssh?
Image links point to Incorrect (Previous) subdomain After Migration
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
Image uploads used to work but no longer do after forum name change?
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?
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 remove "Website Name" links shared in a topic/post?
./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
Images not appearing after domain change
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
How to change URL associated with Activate Account button
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
Change from example.com to community.example.com
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
Migrate a phpBB3 forum to Discourse
Missing avatars and site images after import of a backup
Discourse Install on Lightsail
Ssl_error_bad_cert_domain