Menu

Setting aside a subdomain for my Discord Server

Context

So, I recently saw a livestream from Riccio, just having had completed a stream myself (you should've been there, it was a lot of fun!). While I ended up catching it right as it was ending, I noted the following thing on his title card:

Naturally I was curious as to how someone like myself could get a vanity URL from Discord, so that if a viewer wanted to get involved, it's easy! A little bit of googling led to this page:

Discord probably decided that good tools should really only go to people that can bring in money since they're probably running at a too high a cost to do it for everyone:

It's probably for the best they don't let any server reserve invite URLs since it'd probably lead to impersonations trying to scam out of money or games and would lead to a lot of complaints.

They also have a bunch of other features, but I really don't care about those.

Let's do something about it

It's a given that to do this, you probably already have your own domain name to make the necessary changes, and that you already have some experience altering DNS records for your site.

Subdomain setup

First of all, we need to set an A record in order to point the new subdomain towards our IP. My VPS comes with an IPv6 address, so I'll also set an AAAA record for that too. This is the easy part:

So, now the above records means that discord.chaoticlaw.com now points to my VPS IP. With that done, let's move on to allocating a Virtual Host.

Virtual Hosts

In NGINX, you can designate hosts by writing out a server block in a configuration file with server_name.

server_name: discord.chaoticlaw.com

Basically, when your web browser attempts to navigate to a site, it sends the host name it's looking for in the request. With this, NGINX will run with the configuration if there's a matching server_name.

After validating that this configuration works out (using nginx -t), we can reload the NGINX service by restarting it (sudo service nginx restart).

Then after that, I spent some time composing the page to make it look nice and fitting with my brand. Because I own the content and the gateway, it's only appropriate that I customise it to my liking. The features I've included are:

A button which links to the custom invite URL given to me by Discord

Custom background, embedded into the page and loaded with a blur effect

Custom content (I ended up listing the rules and their associated penalties)