All Virtual servers go to /apache2-default/

I installed Virtualmin 3.68 on a clean Debian 4.0 vps. Then i added a virtual server and sub domain for it. Both the main and sub virtual server do not work, they always redirect to /apache2-default/

When i look at the apache2 virtual hosts in webmin everything looks like its redirecting to the right folders and such.

What am i doing wrong ?

OS: Debian 4.0

What does this file look like:


NameVirtualHost *
NameVirtualHost ::1:80
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/
&lt;Directory /&gt;
	Options FollowSymLinks
	AllowOverride None
&lt;Directory /var/www/&gt;
	Options Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	allow from all
	# This directive allows us to have apache2's default start page
            # in /apache2-default/, but still have / go to the right place
            RedirectMatch ^/$ /apache2-default/

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
&lt;Directory &quot;/usr/lib/cgi-bin&quot;&gt;
	AllowOverride None
	Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
	Order allow,deny
	Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ &quot;/usr/share/doc/&quot;
&lt;Directory &quot;/usr/share/doc/&quot;&gt;
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from ::1/128


You don’t want * or NameVirtualHost ::1:80 in a virtual hosting environment. It’s really difficult to get it right. If you always use IPs and explicit ports, you won’t end up with sites showing up in places you don’t think they should (but Apache disagrees…and Apache is always right).

So what do i do here? Sorry buy im totally new at this. I removed the NameVirtualHost *
NameVirtualHost ::1:80

from the conf and restarted the apache buy its still the same. And how do i make it so every default request goes to and not apache2-default?


First, if that VirtualHost section still reads “<VirtualHost *>”, that may cause trouble still, ou’ll want to change that to “<VirtualHost x.y.z.q:80>”, where “x.y.z.q” is your IP address.

However, there still remains a problem for you, in that I believe Apache always uses the first VirtualHost line as the default site to display.

So to fix the default, you’d either need to change the order Apache sees the Virtual Host sections, or you could add a direct into /apache-default/ to redirect to the site you wish to be the default.

It’s possible Virtualmin offers a simpler way to fix that issue, but I’m not quite sure what it is :slight_smile:

Virtualmin 3.68 introduced a “default” site juggler. It’ll move the site marked default to the top of the list. I don’t actually know where that option is, but I saw the SVN checkin of the code to do it…so I know it’s in there.

I didn’t think we were trying to do “default” here, though…I thought we were trying to fix “all virtual servers go to apache2-default”. Which is a symptom of having the “default” (or any generic * NameVirtualHost/VirtualHost) server suck up everything else that doesn’t have a first-best match on the domain.

So, you need to remove all instances of non-specific NameVirtualHosts, which looks like this:

NameVirtualHost *

And make sure you have a NameVirtualHost for each IP you intend to use, which should look like this:


And make sure all VirtualHost sections are pointing to specific, rather than generic addresses.

If it looks like this, it is wrong:

<VirtualHost *:80>


<VirtualHost *>

It needs to look like this:


it works now, thanks :wink:


I also am experiencing this problem. I think it coincided with a recent Apache2 update.

In my case, I have 3 domains, each one using SSL websites. The first one was installed on internal ip address, the other two had to be installed by Virtualmin using virtual ip’s.

All three webservers point to the domain on internal ip address As far as I can see, Virtualmin has set them up correctly with their own public_html directories, but they are not using them. I’ve checked by placing an index.html file in each - they only show that page when it is in the public_html directory belonging to the first domain on

I’ve checked the apache2-default file and removed any NameVirtualhost * and explicitly stated all the ip addresses I’m using as follows:


The VirtualHost statements in Apache2/sites-available explicitly state the internal ip addresses as you recommended.

When I get Virtualmin to re-check configuration it states that the Default IP address for virtual servers is How do I get Apache to send the other two domains on virtual ip’s to their own public_html directories? Everything else seems fine:

The status of your system is being checked to ensure that all enabled features are available, that the mail server is properly configured, and that quotas are active …

  BIND DNS server is installed, and the system is configured to use it.

  Mail server Postfix is installed and configured.

  Apache is installed.

  Webalizer is installed.

  Apache is configured to host SSL websites.

  MySQL is installed and running.

  ProFTPd is installed.

  Logrotate is installed.

  SpamAssassin and Procmail are installed and configured for use.

  ClamAV is installed and assumed to be running.

  Plugin DAV Login is installed OK.

  Plugin AWstats reporting is installed OK.

  Plugin Mailman is installed OK.

  Plugin Protected web directories is installed OK.

  Using network interface eth0 for virtual IPs.

  IPv6 addresses are available, using interface eth0.

  Default IP address for virtual servers is

  Both user and group quotas are enabled for home and email directories.

  All commands needed to create and restore backups are installed.

… your system is ready for use by Virtualmin.

I hope you can shed some more light on this irritating problem.

Well, this sounds like a lingering "VirtualHost *" in there somewhere.

If you type:

grep -i ‘<virtualhost’ /etc/apache2/sites-enabled/*

Can you verify that none of them have a * listed?

Also, you might consider restarting Apache, to make sure it’s running with the latest configuration.

I've checked the apache2-default file and removed any NameVirtualhost * and explicitly stated all the ip addresses I'm using as follows:


The VirtualHost statements in Apache2/sites-available explicitly state the internal ip addresses as you recommended.

You’ve missed something. The cause of the problem is that one site is sucking up requests because it is the “first best” match for a particular IP:port combination. So you’ve either got problems with your public to private IP forwarding (so those non-default IP hosts are coming in on the wrong IP and the name is meaningless for that IP:port combo, so it falls through to the “default”) or you’ve still got some indeterminate IP:host combos in there (* or *:80) somewhere.

If you’re sure you’ve corrected the * stuff, then check your routing. If there are multiple private IPs, you’ll need as many public IPs forwarding to them, and they must be correct (e.g. DNS says public IP is x.x.x.x, so x.x.x.x much map to the private IP Apache thinks is right for that name) or you’ll get exactly the behavior you describe.

Joe, thanks for that! Yes, it was the router problem. I only have one static external ip address at this location, so it looks like I will have to run SSL on one of the domains only (not a major problem for me, but could be to somebody else).

I have now deleted the other two domains on virtual ip’s and created them again to share the same internal ip (I understand that you need virtual ip’s to run SSL on more than one domain).

All three domains now resolve correctly to their own public_html directories.

Now trying to install Joomla 1.5 in one of these directories and Joomla has detected that it does not have MySQL support! MySQL server is most definitely running. I found this link that seems to describe the problem:

But, that’s another problem…


Yeah make sure you have php5-mysql installed.

If you’re still having troubles, create a PHP script, and have it run phpinfo() – and use that to verify that the MySQL module is loading.

If things just aren’t working, yell and we’ll lend a hand. Help our sanity and start a new thread though :slight_smile: