Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been building a dev machine over the last week and it has created some interesting question in my head. One of which is whether setting up an apache vh is better than creating an alias.

Now, I know the answer here is going to be "it depends". So, I want to be a bit more specific and ask: which one is best for flexibility and which is best for customization?

What do you recommend for a dev machine?

share|improve this question

A ServerAlias simply "sets the alternate names for a host." As such there is no flexibility or customization possible. (Certainly you could play games by looking at which Host: was present in the HTTP header but that is pathological.)

Thus if you need no flexibility or customization it is much easier to enter one line in a config file than define a new vhost. If you need any flexibility or customization you must use a vhost.

share|improve this answer

Do what you're most familiar with. Apache is very configurable, so you really can't say just "for flexibility" and "for customization". I would choose virtual hosts and possibly some url rewriting, but it still really depends on what you're gonna do.

share|improve this answer

I'd recommend virtualhosts, as its very easy to separate those directives and configs into easily swapable and customizeable files.

share|improve this answer

If you have a few sites with different domains, you should use Virtual Hosts. Use ServerAlias only if you have a few domains (or www.domain.tld and domain.tld) linked to one site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.