Subdomain doesnt work on Apache 2.2 and Debian 7

June 22, 2014 4k views
Hello, I want to setup a subdomain in my droplet, I read and follow this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-debian-7 Yep, all right. But, not work for me. First, I point the dns of my domain in godaddy to: NS1.DIGITALOCEAN.COM. NS2.DIGITALOCEAN.COM. NS3.DIGITALOCEAN.COM. Then, I installed apache2: #apt-get install apache2 I created the directory for my domain in /var/www/mydomain.com And for my subdomain: /var/www/mydomain.com/subdomain I copied the file /etc/apache2/sites-available/default and name mydomain.com and other with name subdomain.mydomain.com (all in this same directory). I opened the file mydomian.com and add this line: ServerName mydomain.com And change this: DocumentRoot /var/www/mydomian.com Then, the same for the file subdomain.mydomain.com Add the line: ServerName subdomain.mydomain.com And change this: DocumentRoot /var/www/mydomian.com/subdomain FInally: #a2ensite mydomain.com and #a2ensite subdomain.com Then: #service apache2 reload But not work! The domain : mydomain.com works great, very great, but the subdomain doesnt. In my browser I see this error code: Código de error: ERR_NAME_NOT_RESOLVED Well, I tried to set the subdomain in my droplet cpanel add this A record: A mydomain.com ip.ip.ip.ip But nothing. :( Why? ? Ps. Sorry for my bad english.
2 Answers
You didn't add the subdomain in DigitalOcean's panel under DNS.
  • This? http://i.imgur.com/b1OdRka.png Doesnt works! :(
  • For the A record, you shouldn't write out the full domain like that, just the sub domain. So you want two A records for the domain:
    @ IN A IPv4address
    subdomain IN A IPv4

DNS is cached and takes time to propagate. Also, please don't redact anything except passwords. It makes it harder to help you in nearly every situation and makes it impossible in some.
Have another answer? Share your knowledge.