Apache2 Doesn't Serve Subdomain Alias

Posted by Cyle Hunter on Server Fault See other posts from Server Fault or by Cyle Hunter
Published on 2012-11-01T20:32:29Z Indexed on 2012/11/01 23:05 UTC
Read the original article Hit count: 406

Filed under:
|
|

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
  </Directory>
</VirtualHost>

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

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost