default web site always the last virtual

Hello!
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>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot /www/docs/dummy-host.example.com

ServerName dummy-host.example.com

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>

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 xxx.xxx.xxx.xxx:80 <VirtualHost *> ServerAdmin webmaster@localhost
    DocumentRoot /var/www/
    &lt;Directory /&gt;
            Options FollowSymLinks
            AllowOverride None
    &lt;/Directory&gt;
    &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/
    &lt;/Directory&gt;

    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
    &lt;/Directory&gt;

    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 127.0.0.0/255.0.0.0 ::1/128
&lt;/Directory&gt;

</VirtualHost>

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:

hal

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 http://www.virtualmin.com/documentation/id,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 xxx.xxx.xxx.xxx:80 <VirtualHost *>

to

NameVirtualHost xxx.xxx.xxx.xxx:80 <VirtualHost xxx.xxx.xxx.xxx:80>

and also created a virtualhost for port 443

hal