new subdomain with virtualmin effected my original virtual server setup without virtualmin

I have been running webmin and had some virtual servers set up. I wanted to create a subdomain for the domain that was already setup as a virtual server and was advised to use virtualmin.

I got this working and added a subdomain and now the main domain is pointing to the subdomain home directory as well as my new subdomain?

What have I done wrong? Should I create a new virtual server with virtualmin for my original domain name and will this effect my email set up with MX and CNAME records that have been confirgured with the original virtual server not using virualmin?

Thanks.

Howdy,

Hrm, so it sounds like you’re saying your existing domain was created prior to having Virtualmin setup?

Virtualmin would need to know about all of the domains running on your system in order to be able to effectively manage domains being added… otherwise weird things can happen :slight_smile:

In fact, the recommended way to use Virtualmin is to install it on a freshly installed OS (using the install.sh script), then begin adding domains into it from there.

Now, it can work on an existing system, but that’s a more complex setup and requires some manual configuration. The install.sh won’t work on a server with live sites, I don’t recommend running it as you risk harming any existing data you have.

If you’re installing Virtualmin onto an existing system, what you’d want to do is go into Add Servers -> Import Virtual Server, and import all the existing domains you have today.

As far as your site that isn’t working now – do you see the configuration for it in the Apache config? Also, do you see a “NameVirtualHost” line? You’ll need to have one of those setup to match the VirtualHost line of your various domains.

-Eric

Yes I do have a NameVirtualHost and yes I enabled virtualmin after the main domain was live. The new set up points my original domain and subdomain to the same place. See below from the config file.

images.domain.com and domain.com point to the same document root now at /home/images@domain/public_html in the NameVirtualHost

//--------------- original virtual host when virtualmin was not enabled -----------------------------

<VirtualHost *:80>
DocumentRoot “/home/apache2/servername/docroot/”
ServerName servername
<Directory “/home/apache2/servername/docroot/”>
AllowOverride AuthConfig
Order allow,deny
allow from all
Options +Indexes

//--------------------- new entry added through virtualmin ------------------------------------------------

NameVirtualHost ipaddress:80

ServerName images.domain.com
ServerAlias www.images.domain.com
DocumentRoot /home/images@domain/public_html
ErrorLog /home/images@domain/logs/error_log
CustomLog /home/images@domain/logs/access_log common
ScriptAlias /cgi-bin/ /home/images@domain/cgi-bin/
<Directory /home/images@domain/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All

<Directory /home/images@domain/cgi-bin>
allow from all


Ok I can see some of the issues. My wannabe sub domain is actually set up to be an A record in the BIND DNS pointing at the server IP - my original or root domain is also an A record poinitng at the server IP.

I am wandering if all I need to do is just add a new CNAME record in the BIND DNS settings for my root domain and then add a new virtualhost in the apache2 config file setting the server name to my sub domain and setting a new document root?

If I delete my NameVirtualHost that has been added from virtualmin and also the BIND DNS domain name is this going to set everything back to how it was before I got virtualmin working?

Does this sound realistic?