5

I am running Windows 7, Apache 2.28 is my version of Apache, localhost and virtual hosts run well.

Only one issue - what's the best alternative to using the HOSTS file?

I tried DNSKong, but not sure if that's the best idea... isn't that a site-blocker?

What pseudoDNS software or free DNS software could I use so I didn't have to type into HOSTS file:

127.0.0.1 mysite1.com
127.0.0.1 www.mysite1.com
127.0.0.1 siteonlocalhost.net
127.0.0.1 www.siteonlocalhost.net

for my virtual hosts in httpd-vhosts.conf and have it running as a service to get the DNS recognized?

I'm new to this side of Apache (OK with the basics of getting it up and running), but thought I'd try something new.

All advice appreciated, thanks!

JdeBP
  • 3,970
  • 17
  • 17
akburn86
  • 51
  • 1
  • 2

2 Answers2

2

Putting entries in the HOSTS file will cause those names to resolve to the loopback IP address and will let you access those virtual hosts by name from the computer where the HOSTS file is located.

If your issue is that you just don't like typing the entries into the HOSTS file you could probably write a simple script to parse your Apache configuration, locate all the virtual host names, and generate a HOSTS file automatically. I've never heard of somebody doing that, but it's certainly possible. (That seems like a lot of work to avoid some typing but, then again, you should see some of the stupid scripts I've written... >smile<)

If you're only going to be accessing those virtual web hosts from one computer I think you're probably best off just using the HOSTS file. As soon as you want to access those hosts from another computer on your LAN you'll find that using the HOSTS file isn't a "scalable" solution. In that case, you'll want to install a DNS server onto a machine on your LAN, configure the computers on the LAN to use that DNS server, and create zones for the domains you'll be hosting in that DNS server. It doesn't sound like that's what you're asking for, but that's the logical "next step" when you graduate to needing access to these virtual web hosts on multiple computers.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
2

You can install and run a DNS service on your system and configure your network settings to use it; there are plenty of them around.

But then you would need to add each website name to your DNS service instead of the hosts file; depending on the software you choose, this would mean typing it in some GUI tool... or editing a text file.

I really don't see any way in which this would be easier or quicker than modifying the hosts file :-)

Massimo
  • 68,714
  • 56
  • 196
  • 319