0

I had this working, then my VM server crashed.

I'm running Ubuntu on Oracle VirtualBox. Now I'm trying to add some server aliases, but it's not working.

In my 'sites-enabled' folder I have a file called mysite.com. This has the following data:

<VirtualHost *:80>
  DocumentRoot /var/www/mysite/
  ServerName mysite.com
  ServerAlias www.mysite.com, sub1.mysite.com, sub2.mysite.com

  <Directory />
    Options FollowSymLinks
    AllowOverride All
  </Directory>

  <Directory /var/www/storelocator/>
    AllowOverride All
    Allow from all
  </Directory>
</VirtualHost>

But I'm still not able to access the site using sub1.mysite.com. It only shows me the folders in www root folder.

What am I missing here?

Steven
  • 275
  • 2
  • 9
  • 21

3 Answers3

5

Try removing your commas. I've always used spaces to delimit the hostnames (same goes for /etc/hosts as well)

http://httpd.apache.org/docs/2.2/mod/core.html#serveralias

Mike G
  • 221
  • 1
  • 6
1

Your definitions seem totally correct to me. However this rather sounds like a DNS issue. Depending on your host, try refresh you DNS cache (depending on your OS) and check if sub1.mysite.com matches the IP of your VM.

Chris
  • 1,185
  • 2
  • 9
  • 18
  • Since this is on a VirtualServer on my machine (running Win7) I'm not sure I have a DNS chache? Also, something I forgot to mention. I'm not getting a blank page. The page shows me the folders in www root folder. – Steven Feb 29 '12 at 12:46
  • I'm able to ping sub1.mysite.com. So it's def. DNS problem. – Steven Feb 29 '12 at 13:19
  • I never put up `ServerAlias` in one line, but one under the other. So this slipped past my scope here. Glad the comma-issue solved it for you. – Chris Feb 29 '12 at 13:44
0

Can you remove replace the ServerAlias line entry as given below, restart Apache and then try ?

ServerAlias www.mysite.com sub1.mysite.com sub2.mysite.com


sudo /etc/init.d/apache2 restart