Posted 2009-11-10 14:14 by Joe
How do I make domains available before the DNS changes are made at the registrar?
- or -
How do I make a users website available at "http://www.mydomain.tld/customerdomain"?
Virtualmin supports a couple of methods of "previewing" a site before the DNS stuff is pointing to the right place, though only one is available by default.
There is also the universal method within Apache (which is probably what you're used to seeing if you've used other virtual host administration tools), 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 to the end of this entry before turning it on, we provide better options). Here's how:
Browse to the Apache Webmin module.
Click on the Default virtual server (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. Note that if you've configured Virtualmin to create domains with a different path convention (e.g. "/home/a/abc") things get more complicated and you'll need to construct a path using the variables documented here:
http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.html
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). Just select the radio button beside "Create under" and fill in the domain under which you'd like all of your customer domains to appear.
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.

Anyone know where the 3rd option "Best" is located in Virtualmin 3.79.gpl?