Joyent

Previewing a domain

If you would like to preview a domain or website but haven’t switched the DNS entries for your domain over to Joyent’s name servers yet, you can use Virtualmin, or tweak your local DNS

Make sure you have enabled the web virtual server, otherwise you will not be able to serve websites from your domain. You can enable the web virtual server from Virtualmin by doing the following:

  1. Sign in to Virtualmin (see Account logins and important URLs).
  2. Select a virtual server from the drop-down in the left-hand navigation (your main virtual server should be already selected when you first login to Virtualmin).
  3. Click Edit Virtual Server in the left-hand navigation.
  4. Click Enabled features
  5. Select Web virtual server enabled? and click Save Virtual Server

Using Virtualmin

  1. Sign in to Virtualmin (see Account logins and important URLs).
  2. Select a domain from the drop-down in the left-hand navigation (your main domain should be already selected when you first login to Virtualmin). The domain you select here will be the one that you’ll be previewing.
  3. Click Services and the click View Website via Webmin.

Not all elements of your site may show up properly when viewed this way. For example, remote images (images linked from external sources) might appear broken.

Tweaking your local DNS

The secret here is editing the hosts file, which your computer always checks before asking any information from the valid nameservers of a domain.

On Unix/Linux/OSX, this file is usually located at:

/etc/hosts

On most Windows XP systems, this file is located at:

c:\windows\system32\drivers\etc\hosts

On most Windows NT/2000 systems (and upgrades from Windows 2000 to XP), this file is located at:

c:\winnt\system32\drivers\etc\hosts

On most Windows 95/98/Me systems, this file is located at:

c:\windows\hosts

If you edit the hosts file with Notepad, be sure that it does not add a .txt extension when you save the file. On Windows XP and 2000 this is not a problem, but on most older versions of Windows you should change the Save as type to All files in the Save As dialog.

Next, add one entry to this file in the form:

111.222.333.444 your.domain.com

Replace 111.222.333.444 with the server IP you are testing/building on. Replace your.domain.com with the name you wish to preview. Whitespace is fine between the IP and the domain name - most people use a tab or two. You can also do something like this:

111.222.333.444 yourdomain.com www.yourdomain.com

which will cover both hostnames (with and without the www) for your site.

Once you’ve modified your hosts file, you should also flush your computer’s DNS cache. On Unix/Linux/OSX (up to 10.4.x), type the following in the command line:

lookupd -flushcache

Leopard Users will use the following line:

dscacheutil -flushcache

On Windows, start the command promt (from the Start menu, click Run, type cmd, and press Enter) and type the following:

ipconfig /flushdns

Once you’ve completed all three steps you may also need to refresh or restart your browser.

This will only work from your computer - everybody else will still see the real site wherever it is. Also, you should remember to revert the changes to the hosts file when you are done, otherwise you might forget and lose track of what site you are seeing.

 
shared/kb/preview-domain.txt · Last modified: 2007/12/05 17:29 by bernd
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki