Introduction#
Recently, I bought a new domain name and changed it for my blog. However, since Mix-Space handles domain name changes differently from other programs, I can write another article about it.
Main Content#
Changing the backend is not difficult. Just go to Settings → System → Website Settings
and rewrite the domain name. Then, in the installation directory of the core, edit the .env
file and add the new allowed domain. Finally, run docker compose up -d
again.
The most troublesome part is the image links within the articles. Previously, when I used Typecho, I could solve it with two commands in MySQL. But this thing is MongoDB, which I have never used before, so I don't know how to do it. I searched online but couldn't find a good solution. Then I thought, can I use a database management software to solve it?
Important
This is a high-risk operation because the mongo in Docker has no authentication. Please make sure to follow the instructions below only if your data is secure.
First, find the installation directory of the core and edit the docker-compose.yml
file. Find mongo
and insert the following code in the appropriate place:
ports:
- '27017:27017'
After saving, run docker compose up -d
. Then open the database management software (I'm using Navicat
). Connect to your database and open the Collections
. In the collectionName
, posts
, notes
, pages
, options
, and users
collections, use Ctrl + H
to find and replace your old domain name with the new one.
Click on "Replace All" and then click "Apply".
This way, the image links within the articles will be replaced.
Important
After modifying the database, remember to delete the ports
setting for mongo
in docker-compose.yml
. Then, run docker compose up -d
again.
As for the frontend, I'm using Vercel, so I need to change the API address in the project's Settings → Environment Variables
.
Then, in the Deployments
section, click on the deployment marked as "Current".
Next to "Visit", click on the three dots and select "Redeploy". Click "Confirm".
If you are deploying locally, just follow the instructions in the previous article and redeploy.
Afterword#
If you find this article helpful, please give it a like or share it with those who need it, meow~
This article is synchronized and updated to xLog by Mix Space. The original link is https://blog.nekorua.com/posts/maintain/112.html