Virtual host testing without DNS referal

I have a number of domains pointing to the same ip address using Apache virtual host. It works great. Now I have a site hosted on a different server that I want to move and test on my Linode server using Virtual Host. I want to test it before changing the DNS forwarding to the new server. How can I test?

Something like http://173.255.1.1:domainname.com

Nothing that I try like this works.

5 Replies

Edit your computer's local hosts file and point that ip address to that domain name.

173.255.1.1        domainname.com

OK but then how do I access the original server/site with my browser?

I guess for the purposes of the testing I could give the new server a different domain name temporarily to keep the two straight.

Thanks.

Now that I know how that host file works I'm mapping all my local fixed ip address boxes - routers, network printers, DirecTV receivers, to names. Cool.

Edit your computer's local hosts file and remove the line that you added in Step 1.

Or: create a DNS record, e.g. "dev.example.com", to point to the new IP. Tell your web server to expect traffic on dev.example.com, and it shall work. This is much more useful, especially when multiple people need to share in the hallucination.

@hoopycat:

Create a DNS record, e.g. "dev.example.com", to point to the new IP. Tell your web server to expect traffic on dev.example.com, and it shall work.
This sounds good. So if I understand it correctly, if "example.com" has a DNS record somewhere (? I'm not sure where) that points to ipaddress1 then I could create a DNS record somewhere that points dev.example.com to my Linode server at ipaddress2.

My question is where can that second DNS reference be made if I want the client to see the test site? Does it have to be with the origional domain name registrar or would it work to just use the Linode DNS service? I'm guessing I have to get to the original registrars records.

You'd add the "dev" record to whichever nameservers are handling example.com. The same place you'd go to point www.example.com to a different IP address, basically. Might be with the original registrar, or it might be with the current hosting company, or it might be with someone entirely different.

Or!, if you have another domain within your control (i.e. your main/"corporate" domain) and don't want to muck around with the existing domain at all, you can also add a record to your domain. This is handy when customers are involved, since you can fling something up without involving them at all.

Say your domain is sodtech.net, and you're working on a new site to replace example.com. You could add "example.sodtech.net" to sodtech.net's DNS, and set it up in your web server as an alias for the new example.com site.

Both approaches work just fine, and would allow the site to be visible to anyone who knows the temporary location.

(Which reminds me: you might want to set up basic authentication to "hide" the site a bit while it's under development. I use an approach not unlike the "READ ME: username is foo, password is bar" used on forum.linode.com; just enough to keep the bots out.)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct