You already use your domain for a company website and now you want to use Mastodon with your domain?

It is possible to install Mastodon on a subdomain (mastodon.example.com) and still be found in Fediverse under example.com. Mastodon is a decentralized microblogging network, that is similar to Twitter, and can be self-hosted on your own server.

Hosting Mastodon on a currently used domain name

Environment Settings

Note

By the way, if you haven’t installed Mastodon on your server yet, you can follow my instructions to install Mastodon on your server using Docker and Traefik as a reverse proxy.

In order to perform the following steps, you must have your Mastodon instance installed on your subdomain.

If you followed my instructions for installing Mastodon with Docker, you will find a file .env.production in the directory where Mastodon is started with docker-compose. We now open this file and set the following two environment variables:

LOCAL_DOMAIN=example.com
WEB_DOMAIN=mastodon.example.com

For the first value LOCAL_DOMAIN you use your domain name without the subdomain under which Mastodon really runs. This allows you to specify your username with @[email protected] instead of @[email protected].

As WEB_DOMAIN you now write down your subdomain where you originally installed Mastodon.

For these adjustments to work, you now need to restart Mastodon once.

After setting these two values, you can use Mastodon with a domain that is already running a completely different website without having to move anything.