Subdomain not working

Hi, thanks for looking,

I have done a successful subdomain on my linode before. I am following the same steps, but now it does not work, in firefox, I get Problem loading page "Firefox can't find the server at stats.mydomain.com".

Here is what I've done/got:

In the LM: A/AAAA record added with the correct IP and the right subdomain name "stats" (entering "stats.mydomain.com" does the same thing)

On the server, I've done the following

$ sudo nano /etc/apache2/sites-available/stats.mydomain.com

# Place any notes or comments you have here
    # It will make any customisation easier to understand in the weeks to come

    # domain: stats.mydomain.com
    # public: /var/www/vhosts/stats.mydomain.com/

    <virtualhost myip:80=""># Admin email, Server Name (domain name) and any aliases
      ServerAdmin admin@mydomain.com
      ServerName  stats.mydomain.com
      ServerAlias www.stats.mydomain.com

      # Index file and Document Root (where the public files are located)
      DocumentRoot /var/www/vhosts/stats.mydomain.com/

 <directory var="" www="" vhosts="" stats.mydomain.com="">Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all</directory> 

      # Custom log file locations
      LogLevel warn
      ErrorLog  /var/www/vhosts/stats.mydomain.com/log/error.log
      CustomLog /var/www/vhosts/stats.mydomain.com/log/access.log combined</virtualhost> 

Now I run the following

$ sudo mkdir -p /var/www/vhosts/stats.mydomain.com/log/ (this creates the parent directory)
$ sudo chown -R myUser /var/www/vhosts/stats.mydomain.com
$ sudo chgrp -R www-data /var/www/vhosts/stats.mydomain.com
$ echo "Hello World" >> /var/www/vhosts/stats.mydomain.com/index.html

Then I enable the site and reload apache

$ sudo a2ensite stats.mydomain.com
$ sudo /etc/init.d/apache2 reload

Upon loading it up in my browser, it doesn't work! Yes the parent domain works, and I've also got a working subdomain for another site on the same server, so I know it's possible.

What have I missed? Thanks for any help,

Bung

2 Replies

I've been informed that there is a delay on DNS refreshes.

You can define a wildcard A record in DNS Manager (put "*" in for the hostname, no quotes) so that all subdomains are automatically covered.

And if you want to test before DNS reflects the change at your ISP, you can add an entry to your HOSTS file:

stats.mydomain.com nnn.nnn.nnn.nnn

To be sure your server is handling things properly regardless of DNS status.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct