Custom Bluesky and Mastodon usernames with your own domain

I recently went through the process of setting up custom handles/aliases for myself using my domain name on Bluesky and Mastodon. I figure I’ll share the steps here in case anybody else with a similar setup (WordPress on Amazon Lightsail) wants to do the same.

Bluesky

Simply follow the instructions that Bluesky have provided here. In Step 5, you will need to add a TXT record to your domain DNS. If you use Amazon Lightsail, click on the Domains & DNS option and then select the relevant DNS zone (in my case, web-goddess.org).

Then click on the DNS records tab and click the + Add record button.

Change the record type to TXT record and then put in the name and response provided by you by Bluesky. (The “host” is the “Record name,” and the “value” is the “Responds with.”) Click save.

Wait a little bit — in my experience, 30 seconds is usually sufficient — and then click that Verify DNS Record button in Bluesky. And then you’re done!

In my case, you can now find me at @web-goddess.org on Bluesky.

Mastodon

Mastodon is a slightly more involved process, and it doesn’t change your official server username but rather gives you an alias that you can give out. In my case, my current Mastodon account is @web_goddess@aus.social. However, if I give out an alias instead, then it doesn’t matter if I change servers in the future — you’ll still be able to find me. I was inspired by these posts by Phil Nash and Maarten Balliauw for how to do it.

First, open up a new browser tab and go to this URL, substituting your own Mastodon account values in there:

https://{instance}/.well-known/webfinger?resource=acct:{username}@{instance}

So in my case, I went to https://aus.social/.well-known/webfinger?resource=acct:web_goddess@aus.social. What you’ll get back is a blob of text (JSON). Copy that and set it aside for the moment.

Then go to the Lightsail console and click on the little terminal icon to Connect using SSH to your instance.

A window with a terminal will appear.

Now you need to go to where the WordPress files are stored for your site. Type in this command in the terminal and hit enter.

cd stack/wordpress/

Important note: The path above is for one of the newer WordPress Bitnami instances. If you have an older instance, the path to where your WordPress files are stored might be different.

Then you’ll need to create a new directory called “.well-known.” (Note the dot in front of the name.) Type in this command and hit enter.

mkdir .well-known/

Then go into that directory. Type in this command and hit enter.

cd .well-known

Now you will need to make a special file called webfinger. Type in this command and hit enter to open a text editor in the terminal.

nano webfinger

This is where you will paste in the blob of JSON text you copied from your Mastodon server. Copy and paste it straight into the editor, and then hit CTRL-X to exit.

The editor will ask if you want to “Save modified buffer?” Type Y for Yes, leave the name as webfinger, and hit enter to save.

You can then exit the Lightsail terminal and close the pop-up window.

exit

If everything worked correctly, you should now be able to go to your own domain and receive the JSON blob back by substituting your domain in this address:

https://{yourdomain}/.well-known/webfinger

In my case, I went to https://www.web-goddess.org/.well-known/webfinger in a browser tab and verified that the JSON was returned.

And that’s it! What does this actually mean? It means I can tell people that my Mastodon username is @kris@web-goddess.org, and if they type that into a search box on Mastodon, it will point them to my official account.

If I change servers in the future, I’ll just have to update the JSON blob with the correct values from my new Mastodon server, and people will continue to be able to find me from the alias.