default web site always the last virtual

I am setting up Virtualmin Pro these days (really impressive), and have come across this problem:
the web site that will show up for domains that point to the server, but have no virtual servers configured in apache, is always the latest virtual that has been added.
so for example, the hostname of my server, which does not have any web site, will show the website of the latest domain i added to virtualmin hosting.
hopefully you understand what i mean.
i want that the default apache website be always a specific one, where i can show something like "domain not active on this server" or stuff like that.
how can i achieve this?
thanks :slight_smile:

by default the IP shows the toplisted virtual domain. At least this was/is so on my server. centos 5.1 VM Pro 3.57

In the - Apache webserver module - global configuration - edit config files - find these lines

VirtualHost example:

Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

server name.

#<VirtualHost *:80>


DocumentRoot /www/docs/


ErrorLog logs/

CustomLog logs/ common


Make sure the dummy server/domein exists and put it on top of the list.<br><br>Post edited by: ronald, at: 2008/05/24 03:18

hmmm i have no such lines.
anyway, if i look at "existing virtual hosts", i can see two entries at the top:

Default Server Any Any Automatic Automatic
Virtual Server Any Any Automatic /var/www/

But somehow they don’t seem to work…

Debian 4.0 here.

hannibal:/etc/apache2/sites-enabled# ls -l total 28 lrwxrwxrwx 1 root root 36 2008-05-19 21:28 000-default -> /etc/apache2/sites-available/default

i seem to have a dummy configuration and it is the very first in the list, but instead, the second virtual in the list is used as default hosting.

so there must be some error in the default virtual config i guess…

NameVirtualHost * NameVirtualHost <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


Any clue?
I’m still in the process of migrating my domain and find this issue really annoying, I want to fix this :slight_smile:


what I did actually was to manually edit the apache config and placed my main domain at the top of the <virtualhost> list.
If any existing domain has a wrong in it then my main domain will show up (in my case it is a hosting promotional domain :wink:

since you are on debian I can’t share my experience as I run on CentOS, however per haps the,troubleshooting_common_problems/ can help a little. There is a section about wrong sites showing up when scrolling down.

Thanks! That did the trick!
I changed

NameVirtualHost * NameVirtualHost <VirtualHost *>


NameVirtualHost <VirtualHost>

and also created a virtualhost for port 443