Aliases for websites

7 posts / 0 new
Last post
#1 Sun, 07/02/2006 - 03:44

Aliases for websites

I am thinking about migrating to Virtualmin Pro from my existing server which runs an Ensim control panel. One of the features of my existing system is that it can display virtual sites as an alias of the main servername. for example.

I've set up VM on a Mac OS X machine to test (The webserver is a Fedora Core) and virtual sites don't seem to be available like this.

Is there some configuration I've missed or will I have to place aliases into the httpd.conf manually to achieve the same effect?

It's a useful feature to me as I can 'preview' sites prior to setting up the domains.

Any help most appreciated, and sorry if it's been covered before.

Thu, 07/06/2006 - 13:21
Joe's picture

Hey Chris,

Virtualmin supports a couple of methods of "previewing" a site before the DNS stuff it pointing to the right place, though only one is available by default.

There is also the universal method within Apache (which is what you're seeing Ensim do), which is discouraged by the Apache developers as it is potentially a security issue (how large a security issue is debatable and depends on the environment...but we trust the Apache folks to know their own software and what is and isn't a good default, so we don't enable it by default). Those issues are increased exponentially by allowing CGI/PHP scripts to run in this way, and I would strongly discourage allowing executables at all in this way.

To switch your Virtualmin server to behaving the way you're used to, you just need to turn it on in Apache (but read this full comment before turning it on--we provide better options). Here's how:

Browse to the Apache module.

Click on the Default virtual server (I suspect any domain will work, but I've always used the Default--just be sure you know what your default Domain is so you can point folks to the right place).

Click on the Automatic Virtual Hosts icon.

Switch the radio button by "Automatic virtual host root" to the one beside the empty field, and fill in the field with, "/home/%0/public_html".

I believe this'll do the trick just like you're used to.

There are other, better, methods of providing preview access and Virtualmin provides easy ways to do them.

The default method is simply to allow access through Webmin as a proxy. In Virtualmin Professional there is always a link labelled "View Website via Webmin" in the left menu pane. Clicking this will allow you to see the front page of your site (and if you use relative links, all other bits of your site), but only to authenticated users. Obviously, this is extremely secure compared to the automatic virtual hosts method, and allows you to test your site before switching DNS. If you just need your domain owner to be able to see their site working before switching DNS, use this option. Note that this has the requirement of the local machine being its own DNS server, as otherwise Webmin itself will get the old DNS information.

Another way, which I believe is the best option (saving the best for last!) and most closely matches what you're currently used to without the security implications, is the "Automatically create alias domain" option (found in every Server Template, though to keep it simple you can just edit the Default template).

This option will cause Virtualmin to create a subdomain under your domain for every new domain you create--this will be immediately accessible with a name like "newdomain.mydomain.tld". Easy to remember for the user (because it's their domain name, plus the name of the company they're hosting with), and it isn't a path-based automatic thing--so non-virtual host home directories won't be potentially exposed in any way, as with the Automatic virtual hosts method above (as used by Ensim, cPanel, and others, I reckon). If you need public access to sites, this is the method you really want. Note that this method also does not break SuExec, as the automatic hosts option does, so CGI scripts (and PHP once we get FastCGI+SuExec working) will run as the user that owns the domain...this is safer.

Hope this helps. Holler if you have any trouble with any of these choices, or if you need any further clarification.


Check out the forum guidelines!

Wed, 08/09/2006 - 22:18 (Reply to #2)

Hey Joe,

I saw this tip in the FAQ and I think I have DNS working correctly in my template - however when I do get the newdomain.mydomain.tld setup it directs me to the root page of the server - the Fedora Core Test page (reads to put content in /var/www/html/).

I'm not sure where I went wrong or if something is missing above. All other sites have worked fine, just these alias seem to want to stick to this test page.

I would be happy to shoot you the actual domain names and all of that if it would help.

Wed, 08/09/2006 - 22:28 (Reply to #3)

By the way - the View Website via Webmin option does the same thing for the domain alias. (Goes to the test page)

While the regular domain that isn't transferred at the registrat yet - when you hit the View Website via Webmin option it goes out to the loaing server web page.

I'm thinking this is expected, as Webmin is just calling the current nameservers for the site - not its local ones.

Please help clarify this - maybe update the FAQ unless I'm just doing something abnormal.

Wed, 08/09/2006 - 23:37 (Reply to #4)
Joe's picture

Hey Ron,

This sounds like it could be a couple of things:

- You have no content in the public_html of the new domains.

- Apache doesn't have a correct NameVirtualHost entry (this would be our fault, though I haven't heard of anyone lately running into this).

For the first one, just make sure you've got some kind of index page in the public_html directory of your new server.

For the second, browse to Webmin:Servers:Apache Webserver and click on "Networking and Addresses". What's in the "Addresses for name virtual servers" field?


Check out the forum guidelines!

Thu, 08/10/2006 - 00:18 (Reply to #5)

Ok, you hit it - I started out with having content, but since I deleted and re-added the server over and over trying to get it to work - I did wind up with nothing in there. Added a quick test index page and like magic it was there...

I went ahead and checked the other settings and they look good. "Name server IP":80

Tue, 07/11/2006 - 12:00

Thanks Joe,

Really, really helpful.


Topic locked