How to add a subdomain to Uberspace

By André Jaenisch on 17.02.2023. About 1 minute reading time. This text is estimated to be very confusing to understand.

Since a while I was puzzled about how to add a subdomain to Uberspace. Turns out, it doesn’t take so much. Before I go into the details, it’s generally recommended by Uberspace itself to prefer separate instances to host content instead of running everything on a single one.

That being said, a subdomain is a good bridge in my point of view to untangle an instance in case you ignored this warning.

Uberspace Manual on Web Domains explains how to register a new subdomain with Uberspace itself:

$ uberspace web domain add subdomain.isabelle.example

Once this commands completed you are given two DNS records (A and AAAA). Take note of them, since we will need them later.

Now that you have added a subdomain it’s time to put content on them. Therefore you will need a new directory that will hold its document root.

$ cd /var/www/virtual/$USER
$ mkdir html/subdomain
$ echo 'Hello Subdomain' > html/subdomain/index.html
$ ln -s /var/www/virtual/$USER/html/subdomain subdomain.isabelle.example

In the last step you log into your domain registrar and add the A and/or AAAA record to point to your subdomain.

The last step was missing for me. By moving content over to a subdomain I can now look into cross-origin requests, solve them and then rent some webspace somewhere else to move content over. The only thing needed then will be an update to these DNS record to request from the new origin. Once that’s done I can remove the Subdomain using the uberspace CLI.