Trouble with vhost working correctly

Hi all. First time user of virtualmin and webmin. Looks good this far =)

I am on CentOS 6, virtualmin installed trough from docs. No trouble installing, did use a minimal centos install (almost nothing extra installed), and took care of all dependencies.

Everything works as expected, exept adding virtualhosts and routing to corrent page.

Server: (/var/www/html/index.php)

Domain 1: (/home/mydomain/public_html/index.php)
Domain 2: (/home/myseconddomain/public_html/index.php)

Each index.php have a simple echo ‘domain’; Just to let me know where I am beeing sent by the server.

So now,
If I visit => I will see the echo for DOMAIN 1
else if => I will see the echo DOMAIN 1
else if myseconddomain => I will see the echo DOMAIN 1

Then I deleted the virtualserver in virtualmin.

Now I will see MYSECONDDOMAIN.Com echo on both and

I have read trough tons of pages now, trying to figure out what settings are wrong. I have the correct ETH0 and ip adress spesified everytwhere I can find, I have checked that no *:80 is in httpd.conf, I have clicked almost everywhere to find any settings that can cause this problem. But I am stuck =(

Any suggestions where to move on from here?


# ifconfig eth0 Link encap:Ethernet HWaddr 00:13:3E:F9:22:33 inet Mask: inet6 addr: fe30::514:3ece:fdd3:2f55/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6265 errors:0 dropped:0 overruns:0 frame:0 TX packets:4071 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:868231 (847.8 KiB) TX bytes:1442665 (1.3 MiB) Interrupt:11

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:305 errors:0 dropped:0 overruns:0 frame:0
TX packets:305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:39760 (38.8 KiB) TX bytes:39760 (38.8 KiB)

# rpm -qa | grep httpd httpd-tools-2.2.15-15.el6.vm.1.i686 httpd-2.2.15-15.el6.vm.1.i686 # cat /etc/resolv.conf nameserver nameserver nameserver domain localdomain

No /var/log/virtualmin/domain*_error.log, or any other pointers in any other log files.

Any suggestions where and what values to check in the different config files?

Thanks for your assistance, it is appreciated!!


It is recommended to use an FQDN for your server (“”) whose domain is NOT under Virtualmin control. You can manage the zone “” in Webmin, but don’t add it to Virtualmin. Doing so could lead to problems like you’re seeing.

When you fix this and still see the wrong domains in Apache, check its virtual host settings in Webmin’s Apache module. All virtual hosts that were created from Virtualmin should have an explicit IP address and port 80.

So if I understand you correctly, I can not create 1 website for (sql,ftp ++) and use the prefix for my server, and display the default website (/var/www/html) for that sub-domain?

httpd.conf => All virtual hosts have server.ip.adress:80 and are not using *:80

I am totally stuck, If I remove all the Virtualhosts, the /var/www/html/index.php display. But if I add any virtualhost to httpd.conf, the vhost /home/user/public_html/index.php will display no mather what url (,, ++) I type in my address bar.

Its like the first virtualhost is a “catch-all” vhost, unless I remove all virtualhosts, then the main server is a catch all.

I need a setup like this: => /var/www/html/index.php (catch-all) => /home/user1/public_html/index.php => /home/user2/public_html/index.php
and so on.

I do not know if it is of any importance, but I have only 1 IP for my server.

All help on this is appreciated, as I am almost at the point where I will leave virtualmin for another CP soon.


If you wish to have “” controlled by Virtualmin, your server’s FQDN should not be anything under *", that’s right. It can be done, but is complicated and can lead to problems like you’re seeing.

Better use a separate “administrative domain” for that purpose, like “”, and give your server(s) hostnames under that, like “”. You could even use a free domain from some dynamic dns hoster for that or something, doesn’t matter, as long as it is externally resolvable and not configured in Virtualmin as a virtual server.

Also, you should not try to use the Apache default /var/www for your web pages. Virtualmin uses the scheme /home/domainuser/public_html for the web site files. All of that can be configured of course, but especially as a newbie, you should better not try that. :slight_smile:

If you need a catch-all domain, you can just create a virtual server like normal, and configure it to be the default for the IP address, under “Server Configuration / Website Options”.

Actually. I am not “that” of a neewbie :slight_smile: I run several webservers, with several domains and websites.

I am a neewbie regarding to virtualmin/webmin, never tried it before, BUT it looks like a really good managing software. Except this minor problem getting it working as I would like it to :slight_smile:

I could look into having a separate domain for my server(s), but as all my servers only run web apps, sql and for some clients, email, and I would prefer do have server1, server2 ++ on main-domain.

If you have any example for config setups for this, terminal or oterhwise, let me know.


My apologies, I figured the “newbie” part was meant towards webhosting in general. :slight_smile:

Unfortunately I don’t have config examples ready for what you intend to do. I only recall that I tried it when I first started working with Virtualmin, i.e. manage the administrative domain with the FQDNs of my servers through Virtualmin, ran into similar problems as you did, and decided to take the easy way out and manage the administrative zone solely with Webmin’s BIND module (which works without problem). :slight_smile:

I do have the administrative domain active in Virtualmin, but only for Email; the DNS Domain feature is disabled, and it does not host any websites.

It is possible though that the issues you’re seeing are not really caused by that, but stem from your attempts to use /var/www as website directory. You should start by creating all your websites as virtual servers in Virtualmin, following the /home/domainowner/public_html scheme, and setting the one that should be your default domain accordingly, like I wrote before.

Due to lack of experience with that setup though I can’t give precise “do this, then that” hint, sorry.

Okei mr Picard =)

I will try to play around with it and see what I can figure out.

Thanks for your help!!

Anyone else with some more tips on what-to-do, let me know :slight_smile:


Okei Captain. I got it working as I wanted =)

Here is how:

Listen 80
NameVirtualHost *:80

display /var/www/html/index.php -

added manually to httpd.conf before creating any vhosts trough virtualmin

<VirtualHost *:80>
Servername localhost.localdomain

display /home/username/public_html/index.php -

added by virtualmin

<VirtualHost *:80>
DocumentRoot /home/username/public_html

display /home/username2/public_html/index.php -

added by virtualmin

<VirtualHost *:80>
DocumentRoot /home/username2/public_html

… more hosts/domains same way as

Looks like virtualmin is inserting NameVirtualHost server.ip.adress:80 everytime I add a new vhost, and apache throw me an error when starting apache.

NameVirtualHost server.ip_adress:80 has no VirtualHosts

But I just quote it out and leave NameVirtualHost *:80 in default httpd config and everything is perfect.

So using * instead of ip for all, is working just fine.

Dev should look into this. so that virtualmin does not insert new NameVirtualHost if it already exist.