6

I've come across this article about Testing Domains and I don't understand why this is useful at all... Why does this differ from using localhost ? Can you give me a concrete example, because in the article it is not clear to me.

Is this different than using Apache's Virtual Host? Does it require less configuration?

UPDATE : I am not a server expert or anything like that, so please don't enter too much in the technical details. I am a web developper, and I am having problems testing multiple websites on my local machine. I feel that this would solve my problem, but I don't understand how I can use it to my benefit! Currently I use Apache's Virtual Host and it is doing well. I want to know how a testing domain like localtest.me is good/better than my current practice.

marco-fiset
  • 179
  • 5
  • 1
    @ScottForsyth-MVP is a [member here on SF](http://serverfault.com/users/17231/scott-forsyth-mvp), if he doesn't chime in here, you could ping him for more info. – jscott May 16 '12 at 12:33
  • To the people who downvoted on this : Would you mind providing a reason why you think it is a bad question ? – marco-fiset May 16 '12 at 19:32

3 Answers3

5

That article mentions the reasons at the bottom. It will allow the use of name-based virtual hosts, you can more accurately test URL rewriting, and you can configure subdomains, which is useful when testing cookie behavior.

MDMarra
  • 100,183
  • 32
  • 195
  • 326
  • I read that section of the article, but I don't understand why this would be useful at all when we already have Apache Virtual Hosts. How do these differ ? – marco-fiset May 16 '12 at 17:07
  • 1
    Apache Name-based Virtual Hosts aren't magic, they require a domain name to work. localhost.me lets you use any subdomain and know it points to 127.0.0.1 so you can actually test your virtual hosts. – gparent May 16 '12 at 17:16
5

Good question. I like that you're making sure that you understand the reasons. And the thread itself has more comment discussion about this too, including possible security concerns (and answers for them).

This isn't for everyone, but for people that do quick testing often and don't want to have to add a hosts record for each test, this a nifty way to do it. It's not a revolutionary replacement to hosts files or a loopback adapter, but it makes things just that much quicker for a quick test.

I can say that it's handy for me when I wear my administrator hat more than my developer hat. A developer will often just a small number of sites on a server and it doesn't change often. In that situation it's not a problem to take the effort to create a hosts entry or to use a corporate DNS entry.

But when I wear my administrators hat, it's often that I'll do a quick URL Rewrite test, or reply to someone in the forums, or prototype something where I only need the domain for 15 minutes. Then this solution is a great benefit to me by allowing me to ignore my hosts file which can easily get out of date with stale records which I forget if I still need or not.

Even as a dev if you often create quick test sites for new technologies, or testing new projects, then this can be helpful. Basically, if you work with different domain names often and you find yourself going to the hosts file, then this can help.

So your mileage will vary. If it doesn't make sense, then you're not working often in situations where it will help. If seeing this is like a light bulb turning on, then you do work often in situations which would benefit from this.

Scott Forsyth
  • 16,339
  • 3
  • 36
  • 55
4

One example that comes immediately to mind is if you're trying to develop more than one website on your local server, and wish to use name-based virtual hosting to have them all on 127.0.0.1.

I don't know why you'd do that if you had any network clue; I'd just throw another RFC1918 network on the fire and hack my local DNS servers appropriately. But then I'm unfazed by BIND config becase I do it every day for a living. If you didn't feel like doing battle with your local DNS, then the Testing Domains hack is quite elegant.

I'm sure other people will be able to think of other applications.

Edit: no, that's not a pretty URL issue per se; doing name-based virtual hosts requires that the different sites are accessed via different domain names, all of which resolve to 127.0.0.1. Using http://localhost/site isn't the same, as each site will then have to be moved up a level before it's rolled into production.

MadHatter
  • 78,442
  • 20
  • 178
  • 229