Your error tells me that the sub-domain name did not resolve.
While there are several reasons why a sub-domain does not resolve, the most common reason is that it is not defined.
You have to add the sub-domain using a CNAME record in the DNS that is
the SOA (statement of authority) for the domain.
Most of the time, the SOA is the DNS server provided by your registrar. If this is not the case, then often it is the DNS server provided by your web host. For new users, this is not always clear. If this is the case, I suggest starting with the registrar and if you need to, simply contact tech support of the registrar or web host and ask. Often tech support can walk you through including the CNAME record for your sub-domain very easily. So if you need help, do not be afraid to ask.
As well, sometimes the DNS setting on the server may be the issue. While walking through this would be a broad topic, most of the time, the local DNS server, if used, does not refer to the localhost properly. Using 127.0.0.1 is standard but may not always work in all cases. You may have to also add the servers IP address. However, default ACLs may not allow this and may also have to be investigated. Also consider that some installs of Bind are configured as forwarders, which is fine, or cache which may have to expire. I installed a newer copy of Bind on one server which gave me fits. I expected the DNS to be configured as a forwarder and it was configured as a cache which held onto a bad IP address. It drove me nuts for quite a while! It was just a matter of clearing the cache or configuring the DNS to be forward only. Much of this depends on what you are trying to do. Again, DNS is too broad to get into details here. Just know that sometimes, DNS installs are not what you expect.