Can't get virtual servers to work

In short: Added a virtual server (tried both via virtualmin and webmin’s Create virtual host) – when I access this domain, I still get routed to the default content in /var/www/

Setup: New Ubunto 10.04 install on EC2. Installed Virtualmin + Webmin via script.

Some debugging info from “Existing Virtual Hosts”:

Virtual Server	Any	80	Automatic	/var/www
Virtual Server	80	/home/crossfitdata/public_html

From /etc/apache2/apache2.conf:

Include the virtual host configurations:

Include /etc/apache2/sites-enabled/
<VirtualHost *:80>
DocumentRoot /var/www
<Directory “/var/www”>
allow from all
Options +Indexes

It looks like my new domain’s configuration is included @ /etc/apache2/sites-enabled/

SuexecUserGroup “#1001” “#1001
DocumentRoot /home/crossfitdata/public_html
ErrorLog /var/log/virtualmin/crossfitdata.com_error_log
CustomLog /var/log/virtualmin/crossfitdata.com_access_log combined
ScriptAlias /cgi-bin/ /home/crossfitdata/cgi-bin/
ScriptAlias /awstats/ /home/crossfitdata/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/crossfitdata/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/crossfitdata/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/crossfitdata/fcgi-bin/php5.fcgi .php5

<Directory /home/crossfitdata/cgi-bin>
allow from all

RewriteEngine on
RewriteCond %{HTTP_HOST}
RewriteRule ^(.) [R]
RewriteCond %{HTTP_HOST}
RewriteRule ^(.
) [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
Alias /dav /home/crossfitdata/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV on
AuthType Basic
AuthName “
AuthUserFile /home/crossfitdata/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
RewriteEngine off

AuthName “ statistics”
AuthType Basic
AuthUserFile /home/crossfitdata/.awstats-htpasswd
require valid-user

RedirectMatch /cgi-bin/mailman/([^/.])(.cgi)?(.)$1.cgi$3
RedirectMatch /mailman/([^/.])(.cgi)?(.)$1.cgi$3

Can anyone give me some hints as to why this new domain isn’t getting routed to the content I put in /home/



It looks like that default VirtualHost that’s in there is causing trouble… where it says this:

Virtual Server Any 80 Automatic /var/www

That “Any” will cause it to override other domains on the system.

My recommendation would be to either remove that VirtualHost altogether from Apache, or to edit it’s config file, and change the VirtualHost entry from this:

<VirtualHost *:80>

To this:

And then restart Apache.


It looks like what you pasted in didn’t take?

I removed the “Any” line (so I only have a domain specific virtual server now). Now if I access the IP or the domain, I get the same 404 error:

Not Found

The requested URL / was not found on this server.

Am I still missing something?


/var/log/apache2/error.log shows both the IP direct access and the domain access both give this error:

[Sun Feb 19 18:48:07 2012] [error] [client] File does not exist: /htdocs

Clearly the routing is still not working…hmm!

Thanks much for any advice!

Removing the IP restriction to the specific domain made this work (for at least one domain). Adding another domain to verify. Any idea why (change from IP to ANY)?

Apache can be very picky about which virtual host it deems it has to use for a particular request. :slight_smile:

If you’re interested in the deeper details, there’s a good explanation for it in the Apache documentation:

I spoke too soon. Now all subdomains route to the first one (actionmeasurement)…

Virtual Server	Any	80	/home/actionmeasurement/public_html	Open..
Virtual Server	Any	Any	/home/andyabramson/public_html	Open..
Virtual Server	Any	80	/home/crossfitdata/public_html Open...