Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My dev machine(Ubuntu 11.04) has many rails app sites on apache2. One of the site config is like this.

<VirtualHost 192.168.1.7:80>
  DocumentRoot /home/ssk/dev/base3/sam/public
  ServerName base3.sam.codepremise.com
  RailsEnv development
  <directory /home/ssk/dev/base3/sam/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>

There are many other sites like this on the same machine. I feel bad about having the IP fixed. So I changed one of the sites like the following.

<VirtualHost *:80>
  DocumentRoot /home/ssk/dev/base3/sam/public
  ServerName base3.sam.codepremise.com
  RailsEnv development
  <directory /home/ssk/dev/base3/sam/public>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </directory>
</VirtualHost>

And I restarted apache. But the site doesn't work and instead some other site came up when I requested from the browser.

Why doesn't the wildcard work?

share|improve this question

1 Answer 1

If you have multiple hosts set up to listen on the same IP and port, and you have only changed the configs for this one to *:80, then one of the others is probably taking precedence. It sounds like you are trying to use name-based virtual hosts (i.e., httpd serves different content for each ServerName, as requested by the browser), but you might be missing a line in your config:

NameVirtualHost *:80

Read the instructions for name-based virtual hosts, and if it sounds like what you want, then you probably just need to add that line, and change all the VirtualHosts to *:80.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.