Skip to content

Create a custom (sub-)domain for your MC Server

I'm in the process of creating a Minecraft Server. And at one point in that process did I had to setup a custom subdomain for it.
Since I was not running a server for such a long time did I had to look up tutorials, bud sadly, these tutorials either didn't explain how you set up a DNS entry with Cloudflare, showed outdated pictures and info on Cloudflare or explained it so poorly, that it didn't help.

So after figuring it out did I now decide to create my own quick guide to explain things. Enjoy.

Note

  • This Guide will only cover how you setup the necessary DNS Entries using Cloudflare. Other DNS Services such as Namecheap or GoDaddy may have different setups for adding new DNS Entries. It's therefore important to do your own research where necessary.
  • I will use the IP 192.0.2.0 and the Domain example.com throughout this Guide which are both examples1 and should be replaced with the IP of your server and the Domain you want to use.
  • To keep the Guide simple to read will I use "domain" to cover both Apex (main) and Sub-Domains, unless where a separation is required for clarity.

1. Choice of Domain and if it should be a Sub-Domain

The first and most important step is to decide what Domain you would like to use and whether it should be a Sub-Domain or not.
The Domain you chose is important, as not only will it be the address players use to join your server, but it will also have an influence on the A- and SRV-Records of your Domain itself.

2. Creating the DNS Entries

Once you've selected the Domain you would like to use is it time to implement the necessary DNS-Entries.
For your custom Domain to work will you need an A-Record and a SRV-Record.

2.1 A-Record

Your Domain requires an A-Record that points to your server's IP.
The Entry may look different depending on if you chose an Apex-Domain or Sub-Domain, with the later having the sub-domain set as the domain's name value, and the former either having no value set, or an @ to indicate it as root.

Apex-Domain Example

Type Name IPv4 address Proxy Status2 TTL
A @ 192.0.2.0 DNS only Auto

Sub-Domain Example

Type Name IPv4 address Proxy Status2 TTL
A mc 192.0.2.0 DNS only Auto

Keep in mind you only need ONE of these entries, depending on whether you want to use a sub-domain or not.

2.2 SRV-Record

The SRV-Record is important for when your server is NOT using the default port 25565, but it also doesn't hurt creating one for the default port to avoid possible issues or conflicts.
Creating a SRV-Record shows a lot of fields to fill out and it's not quite easy to understand what field requires what value.

Apex-Domain Example

The below entries show examples for an Apex- to Apex-Domain and a Sub-Domain to Apex-Domain example. You only need one of them.

Type Name Priority Weight TTL Port Target
SRV _minecraft._tcp 0 0 Auto 25566 example.com
SRV _minecraft._tcp.mc 0 0 Auto 25566 example.com

Sub-Domain Example

The below entries show examples for an Apex- to Sub-Domain and a Sub-Domain to Sub-Domain example. You only need one of them.

Type Name Priority Weight TTL Port Target
SRV _minecraft._tcp 0 0 Auto 25566 mc.example.com
SRV _minecraft._tcp.mc 0 0 Auto 25566 mc.example.com

Explanation

The above examples would create one of the following DNS entries for your domain:

  • _minecraft._tcp.example.com
  • _minecraft._tcp.mc.example.com

The first one would allow players to use example.com to join your server, while the second would allow them to use mc.example.com instead.
The SRV record has the port 25566 configured. This should be changed to whatever port your MC server is using, or it will not work.

Now the important part: The target.
The target tells the DNS manager what Domain - and in the end what IP - should be used with the specified port. This entry needs to be the one matching the A-Record you've created earlier, meaning if you set example.com as your A-Record for the Server, you will need to set that and if you set mc.example.com as your A-Record, you would use that instead.

You can use any sub-domain you like for your SRV-Record, such as play, join or similar. The only important part is, that the name has to always start with _minecraft._tcp, as that tells the DNS Manager that it should handle requests for the "minecraft" service on the "TCP" protocol.

3. Testing connection

Once you've saved your entries and made sure you've filled them out correctly should you test whether it works or not.
One site you can use is mcsrvstat.us. Just enter the Domain you've setup and see if your server appears. If it doesn't, check that your domain returns the right DNS-Entries i.e. by using some tool.
It may also take up to 48 hours for DNS entries to get refreshed, so if it doesn't work, try again a few days later. If it still doesn't work, then you may have some wrongly configured DNS.

Conclusion

I hope this small guide helped you in configuring a Domain for your MC-Server.
If something is unclear to you, can you ask me via Mastodon (Handle is @andre_601@swiss.social) or on my personal Discord Server.


Footnotes


  1. See RFC5737 and RFC2606 about sample IPs and sample Domains respectively. 

  2. It is recommended to disable the Proxying for the Server IP to avoid possible issues with resolving the domain. 

Comments

Comment system powered by Mastodon.
Leave a comment using Mastodon or another Fediverse-compatible account.


Last update: 30. May 2025 ()