0

I have bought a server from linode.com and set it up with my purchased domain from namecheap. Setting up the DNS worked as expected and I followed the official documentation from linode.

But whenever I am trying to set up a subdomain in the same server, despite following the same documentation, for some reason I can't set it up.

Here is the config: Server: Apache on Ubuntu 18.04 Domain: randomxyz.xyz

Here are the steps that I followed:

  • Created AAAA record in Linode Manager Panel.
     IP -> Server IP.
     Hostname -> temp.
  • SSH into the server.
  • created a folder named temp.randomxyz.xyz inside var/www/html.
  • created public_html, log and backups folders for temp.randomxyz.xyz.
  • created temp.randomxyz.xyz.conf in etc/apache2/sites-available
  • put Vhost config in the conf file:
# domain: randomxyz.xyz
# public: /var/www/html/randomxyz.xyz/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin [email protected]
  ServerName  temp.randomxyz.xyz
  ServerAlias temp.randomxyz.xyz

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/temp.randomxyz.xyz/public_html

  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/temp.randomxyz.xyz/log/error.log
  CustomLog /var/www/html/temp.randomxyz.xyz/log/access.log combined
</VirtualHost>

  • Enable the new configured site: a2ensite temp.randomxyz.xyz
  • Reload Apache: systemctl restart apache2

I have waited for more than 48 hours. The Subdomain is not working.

Also, pinging to the subdomain gives this result:

Ping request could not find host temp.randomxyz.xyz. Please check the name and try again.

What am I missing here? Do I have to do something in namecheap manager?

2
  • this works only if a wildcard has been set
    – djdomi
    Aug 25, 2019 at 12:38
  • 1
    The domain randomxyz.xyz isn't registered. You need to actually register the domain name with an accredited registrar before it becomes visible on the Internet. Aug 25, 2019 at 17:20

1 Answer 1

1

Welcome to ServerFault!

Based on your follow-up comment, it sounds like your computer is not able to resolve DNS for temp.randomxyz.xyz -- it says "Could not find host" -- so that's a clear indicate to me that something is off in your DNS for the temp AAAA record. What happens if you do a DNS Lookup from https://mxtoolbox.com/DNSLookup.aspx for temp.randomxyz.xyz?

Did you setup an A record for the subdomain as well as the AAAA record? If not, I would try that. Note that AAAA is IPv6 only. If the main domain has an A record associated with it, then that may be why your computer is able to get to the main domain (because, perhaps your ISP can only work over IPv4).

Once you get your DNS sorted out, the following isn't necessary, but may be helpful as you troubleshoot problems in the future:

For Ubuntu, by default, your error logs are in /var/log/apache2/error.log and your access logs in the same directory.

Now, in your VirtualHost, you've specifically defined the error log for temp.randomxyz.xyz, and pointed it to: /var/www/html/temp.randomxyz.xyz/log/error.log. Have you checked this error log to see what errors it may be logging?

Although not a requirement, I typically use the same .conf file to store multiple VirtualHost containers for the same domain name. So, instead of creating a separate .conf file for temp.randomxyz.com, I would create a 2nd VirtualHost container in the randomxyz.com .conf file.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .