Apache2 Doesn't Serve Subdomain Alias

Cyle asked:

I’m trying to prefix an existing Rails application with a sub-domain, essentially I want the sub-domain to serve the same application.

Right now apache2 serves my application with “www.example.com” or “example.com”.

I adjusted my sites-available virtualhost in hopes of allowing for “foo.example.com” or “www.foo.example.com” however both instances are met with a domain not found error. Here is my current VirtualHost in /etc/apache2/sites-available/example.com:

<VirtualHost *:80>
  ServerName example.com
  ServerAlias foo.example.com *.example.com www.foo.example.com www.example.com
  DocumentRoot /home/user/my_app/public
  <Directory /home/user/my_app/public>
    AllowOverride all
    Options -MultiViews

Any ideas? Note, I realized I probably don’t need a wild card sub-domain for what I’m trying to do, I simply added that in as a last-ditch effort.

Edit: The actual domain is virtualrobotgames.com with the desired subdomain being roboteer.virtualrobotgames.com

My answer:

Host roboteer.virtualrobotgames.com not found: 3(NXDOMAIN)

You haven’t set up DNS for your hostname. It’s therefore impossible for anyone on the Internet to know how to reach the host, since its IP address can’t be looked up in the DNS.

You need to set up the hostname in your DNS control panel, which seems to be hosted with GoDaddy.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.