name based hosting

i have setup virtulmin on etchnhalf using the install script.

the setup installs just fine but when i create virtual servers i can only get the the first site based on alphabetical order.

i have read the faq’s and nothing in them solves this problem.

i am looking for any suggestions for what could cause this problem.

This is covered in the troubleshooting guide here:

http://www.virtualmin.com/documentation/id,troubleshooting_common_problems/#the_wrong_site_shows_up

It’s probably that you’ve got your NameVirtualHost and VirtualHost addresses botched. This is often the case when people try to use * for the IP address in Virtualmin, though there are a number of others ways to get this result.

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

NameVirtualHost *

That’s what I was talking about above. Get rid of that line. It makes no sense in a virtual hosting environment.

ok got rid of that line and i have the same effect it goes to the first site only.

also why by default does virtual min add that line in the first place??

I think you may want to change "<VirtualHost *>" to "<VirtualHost 192.168.0.96:80>".

Also, after you change all that, make sure you restart Apache.
-Eric

here is where i stand now

i did as you both selected the first site comes up the 2nd site displays the apache2-default page.

btw thanks for your help and patience

also why by default does virtual min add that line in the first place??

It doesn’t. :wink:

ok what part of the does put it in? as i didn’t.

what else can i check to get my server to go to that correct site.

i have reinstalled debian and webmin/virtualmin using the script. same problem

i have also tried ispconfig and it worked fine just not how i want it setup.

so basically i’m still lost

What does the Apache configuration look like for the second site again?
-Eric

BTW right after installing virtualmin

the default file starts with:

[color=#0000FF]NameVirtualHost *
<VirtualHost *>[/color]

after createing the first server it changes to

[color=#0000FF]NameVirtualHost *
NameVirtualHost 192.168.0.96:80
<VirtualHost *>[/color]

BTW right after installing virtualmin

the default file starts with:

NameVirtualHost *
<VirtualHost *>

What OS are you running?

i’m running Debian etchnhalf

i also finally figured out why i was having a problem

i had to add

ServerAlias wizardhardware.com

to the configs and all started working why i don’t understand

i have read that. to to be honest i found it vague as how to which config file to check to see if this is the problem

as i used the install script i would have to say it has a possible error as it install with no intervention on my part, but i could be wrong.

this is a typical conf as configured by virtualmin

<VirtualHost 192.168.0.96:80>
SuexecUserGroup "#1002" "#1003"
ServerName princereunion.com
ServerAlias www.princereunion.com
ServerAlias webmail.princereunion.com
ServerAlias admin.princereunion.com
ServerAlias lists.princereunion.com
DocumentRoot /home/princereunion/public_html
ErrorLog /home/princereunion/logs/error_log
CustomLog /home/princereunion/logs/access_log combined
ScriptAlias /cgi-bin/ /home/princereunion/cgi-bin/
ScriptAlias /awstats /home/princereunion/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/princereunion/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/princereunion/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.princereunion.com
RewriteRule ^(.) https://princereunion.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.princereunion.com
RewriteRule ^(.
) https://princereunion.com:10000/ [R]
<Files awstats.pl>
AuthName "princereunion.com statistics"
AuthType Basic
AuthUserFile /home/princereunion/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/princereunion/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName princereunion.com
AuthUserFile /home/princereunion/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
</Location>
RedirectMatch /cgi-bin/mailman/([^/])(.) https://princereunion.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/])(.) https://princereunion.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
</VirtualHost>

<VirtualHost 192.168.0.96:80>
SuexecUserGroup "#1002" "#1003"
ServerName wizardhardware.com
ServerAlias www.wizardhardware.com
ServerAlias webmail.wizardhardware.com
ServerAlias admin.wizardhardware.com
ServerAlias lists.wizardhardware.com
DocumentRoot /home/wizardhardware/public_html
ErrorLog /home/wizardhardware/logs/error_log
CustomLog /home/wizardhardware/logs/access_log combined
ScriptAlias /cgi-bin/ /home/wizardhardware/cgi-bin/
ScriptAlias /awstats /home/wizardhardware/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/wizardhardware/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/wizardhardware/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.wizardhardware.com
RewriteRule ^(.) https://wizardhardware.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.wizardhardware.com
RewriteRule ^(.
) https://wizardhardware.com:10000/ [R]
Alias /dav /home/wizardhardware/public_html
Alias /pipermail /var/lib/mailman/archives/public
<Location /dav>
DAV On
AuthType Basic
AuthName wizardhardware.com
AuthUserFile /home/wizardhardware/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
</Location>
<Files awstats.pl>
AuthName "wizardhardware.com statistics"
AuthType Basic
AuthUserFile /home/wizardhardware/.awstats-htpasswd
require valid-user
</Files>
RedirectMatch /cgi-bin/mailman/([^/])(.) https://wizardhardware.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/])(.) https://wizardhardware.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
</VirtualHost>