Litespeed - Instantiate a virtual host
Instantiating a virtual host in Litespeed is very easy to do. That's all well and good (and this article explains how to go about doing that) but what does it mean?
What is the difference between a standard virtual host and one that has been instantiated?
Before explaining what an instantiated virtual host is, let's have a quick look at how to go about creating a virtual host in Litespeed.
As with any administration in Litespeed, log into the admin gui and navigate to the Virtual Hosts Template page:
Select a template to suit your website. In this case, I selected the PHP_SuEXEC template and 'Added' a Member Virtual Hosts using 'test.net' for the name of the the Virtual Host and the Domain:
'Save' your changes and a Virtual Host has been created (yes it is that simple):
Now comes the choice: do you instantiate it or leave it as a member of the template?
On the surface level there is little to choose between the two methods of serving a domain. Both will be served equally well. There is no performance gain or penalty with either choice and both are configurable.
However, it is the configurability of the Virtual Host that is the key to your decision.
If you host more than one domain on a VPS or full sized server they will have different needs. Even if both are PHP based websites, one will get more traffic than the other. One may provide dynamic content and the other static pages and so on.
Non-Instantiated Virtual Host
If you decide not to instantiate the Virtual Host then any changes made to the template will be reflected in the domain.
You may not realise it at the time of editing, but when you edit a non-instantiated Virtual Host you are actually editing the template of which it is a member.
Let me try and clarify that:
If you have 5 Virtual Hosts, all created from a template, then any changes made to one of the Virtual Hosts will also be shown in the other Virtual Hosts.
This can actually have many advantages in that it saves a lot of time and effort changing one item and have it replicated many time. Remember that automation and ease of configuration are the keys to being a server administrator.
However, the disadvantage is just as described. I make a change to one of the Virtual Hosts and it's shown in the others.
How can this be a tremendous advantage and a disadvantage?
Flip back to when I said that each website will have different needs. This is true. However, when the differences become too great to share configurations there is a need to have one Virtual Host configured differently from the other.
Instantiated Virtual Host
This is where Instantiating a Virtual Host comes in.
This means the Virtual Host is independent of the template and any configurations are for that Virtual Host alone.
Once you have instantiated a Virtual Host, it is moved from the Templates Tab to the Virtual Hosts Tab indicating it is now separated from the configurations of the original template.
Any configuration changes are made through the Virtual Hosts Tab and selecting the relevant domain.
Obviously this has great advantages in that changes are not reflected in other Virtual Hosts.
In the same way as before, this can also be a disadvantage: Do you really want to make the same changes to 5 different Virtual Hosts? What if you have 30 or a 100 instantiated Virtual Hosts?
What decision you make depends entirely on how your websites are viewed, the traffic and so on.
I (nearly) always create a Virtual Host Template and, for the first few days or weeks, I do not instantiate it.
As soon as I see that it needs configuring independently from other Virtual Hosts, I am free to instantiate it.
Summary
Instantiating a Virtual Host creates an independent domain. Any changes to the domain configuration are not reflected in any other Virtual Host.
This has the advantage of independent configuration but the disadvantage that the same changes may need to be made to many instantiated Virtual Hosts.
Having the choice is great for a server admin - start small and scale into your domains.
PickledOnion.
Digg it |
del.icio.us |
reddit |
StumbleUpon

Subscribe to Feed
Article Comments:
VwPete 17 Jun, 2007
hi brilliant setup info, i have just setup my slice host using your top instructions, good job and well done.
But, and there is always a butt :). I am now stuck/trying to work out how I should be setting up subdomains, and parked domains.
If you ever feel like doing more intructions, my vote goes to that.
either way cheers for a job well done
PickledOnion 17 Jun, 2007
Thanks for the comments.
As it happens I am half way through a rewrite article for Litespeed so parked domains will be addressed as well as other redirects.
I hadn't thought of subdomains and variants of domains. It's added to the list!
Thanks, PickledOnion.
Gleb Esman 14 Jul, 2007
Paul, I have a question about .htaccess
I'd like to have all requests to domain.com be "permanently redirected" to www.domain.com I used to achieve it with .htaccess file like this: RewriteCond %{HTTP_HOST} ^domain.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
When i put such .htaccess into Document Root or Virtual Host Root - it seems to have no effect. Could you point me what I missing about .htaccess as well as perhaps any other means to achieve the above?
Thank you very much as always,
Gleb
PickledOnion 14 Jul, 2007
Gleb,
You can use existing .htaccess rules as Litespeed's rewrite rules are based on Apache's mod_rewrite.
Two things:
I really must finish that rewrite article :)
PickledOnion
Gleb Esman 15 Jul, 2007
Paul, thanks, got it.
Here's the way to do it in one place for all Virtual hosts:
Configurations -> Virtual Host Templates- > PHP_SuEXEC -> Rewrite -> Rewrite Rules -> Edit:
RewriteCond %{HTTPHOST} ^$VHNAME RewriteRule ^(.*)$ http://www.$VH_NAME/$1 [R=permanent,L]
Save, Apply changes, Graceful Restart.
Do the same for any already instantiated virtual host. The whole concept of automatic redirecting of domain.com -> www.domain.com is pretty important for SEO and page rank.
Gleb
Gleb Esman 15 Jul, 2007
One thing - how can i add line breaks in this blog posts? :) Without it the whole message get messed up :)
Gleb