Subdomain error: server DNS address could not be found

8,837

Ok so based on your screenshot, you have 2 different URLs for your website, the possible host headers you could use would be:

htmltest.mydomain.com

www.mydomain.com

This is not what you want though, you want:

www.htmltest.mydomain.com

So you should delete the first two (unless you want to keep them, which is perfectly valid), and add www.htmltest.mydomain.com as an A record with the appropriate IP address.

Just a word of caution though, you may need to check with your hosting provider; sometimes simply adding a host record as above (with the subdomain) may not be all that is required to make this work. As I don't know your hosting provider, I cannot say for sure, but generally this approach will work.

Share:
8,837

Related videos on Youtube

Михаил Павлов
Author by

Михаил Павлов

Updated on September 18, 2022

Comments

  • Михаил Павлов
    Михаил Павлов almost 2 years

    I'm trying to add subdomain to my domain. I just installed httpd on my clean centos 7. At first I created file /etc/httpd/conf.d/htmltest.mydomain.com.conf with the following contents:

    <VirtualHost *:80>
      # Admin email, Server Name (domain name), and any aliases
      ServerAdmin [email protected]
      ServerName  htmltest.mydomain.com
      DirectoryIndex index.html index.php
      DocumentRoot /www/sites/htmltest.mydomain.com/htdocs
      # Log file locations
      LogLevel warn
      ErrorLog  /www/sites/htmltest.mydomain.com/log/error.log
      CustomLog /www/sites/htmltest.mydomain.com/log/access.log combined
    </VirtualHost>
    
    <Directory "/www/sites/htmltest.mydomain.com/htdocs">
        Options Indexes FollowSymlinks
        AllowOverride None
        Require all granted
    </Directory>
    

    Also /www/sites/htmltest.mydomain.com/htdocs folder was created with index.html file inside. With this configuration my attempt to access htmltest.mydomain.com gives 'server DNS address could not be found' error in the browser. But mydomain.com opens htmltest subdomains index.html. In my hosting CP dns settings there is mydomain.com with the htmltest 'A' record pointing to server IP, along with the www record. How can I fix this?

    UPD: I've changed domain to use vultr nameservers, and it works properly now.

    • Coding Gorilla
      Coding Gorilla over 8 years
      Can you post a screenshot of the DNS entries from your hosting CP? I'm having a hard time understanding how you have that set up without being able to see it. But it sounds like you have two A records: htmltest.mydomain.com and www.mydomain.com where you want a single A record: www.htmltest.mydomain.com.
    • Михаил Павлов
      Михаил Павлов over 8 years
      @CodingGorilla, please see attached screenshot
  • Михаил Павлов
    Михаил Павлов over 8 years
    thank you for your help, I've changed domain to use hosting nameservers, and it works properly now.
  • Михаил Павлов
    Михаил Павлов over 8 years
    Right now subdomains are working as they should, but www prefix points to one of my subdomains, how can I alias www to second-level domain? Do I need to create www.domain.com.conf file or there is another way to alias?