How to point your browser at websites on your server without registering a domain

I recently started managing my own server and found it difficult to point my browser somewhere on my system without going through DNS records and registering a domain name. That is sort of a pain, but here is a quick hack to make this super easy.

Let’s say you want to create an admin site for your server. This could be useful to view the output of phpinfo() or something like that. Just set up a virtual host like you normally would. For example:

<VirtualHost *:80>
     DirectoryIndex index.php index.html
     DocumentRoot /var/www/server-admin
     <Directory "/var/www/server-admin">
         Options Indexes FollowSymLinks
         AllowOverride All
         Order allow,deny
         Allow from all

Then just add this to the bottom of your /etc/hosts file (assuming your OS is *nix):

Now you should be able to see that directory in your browser.

No TweetBacks yet. (Be the first to Tweet this post)
Share and Enjoy:
  • Digg
  • Facebook
  • Google
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

If you enjoyed this post, make sure you subscribe to my RSS feed!

This entry was posted in Software and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.