Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

4 Answers

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
add comment

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
add comment

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

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.