Create your own testserver with a fake domain (XP)

When you are developing a theme for say Joomla, or editing a lot of content, it is easier now and then to do this offline.
However if you DO want to do this offline, you’ll need a testserver.

I’ve been using JSAS, Joomla StandAlone Server for that purpose (but switched to XAMPP recently).

Once installed, you’re good to go with apache, php, mysql and joomla.

By default it will give you a local webserver on your localhost, reachable on port 85, in other words, to test it, goto :
http://localhost:85/

Inside the JSAS directory you will find a http_root directory, with a www directory inside it, and that’s the directory that will show in your browser by default if you go to http://localhost:85/.

Now imagine you have a site www.mybogussite.com and a www.myothersite.com and you both want to test/develop these offline.
You probably end up with something like:
http_root/www/mybogussite
http_root/www/myothersite

or

http_root/www/www.mybogussite.com
http_root/www/www.myothersite.com

BUT since you have to access them through links such as localhost:85/myothersite/ links might be broken.

One other way to handle this is by using virtual hosts.

First we need a fake domain name address. In Windows XP we do this by editing the hosts file, found in:
C:\WINDOWS\system32\drivers\etc

Add a line to this file such as:
127.0.0.1                www.mybogussite.local

Now reboot your pc.

Next step is to edit your apache conf file, found in http_root/usr/local/apache2/conf/httpd.conf:

<VirtualHost *>
DocumentRoot /www/www.mybogussite.com
ServerName www.mybogussite.local
</VirtualHost>

Note that you should fill in the specific name of your local directory after documentroot and whatever you’ve put into the hosts file after the ServerName.

Now restart apache and you’re done, open your browser and enter www.mybogussite.local into the address bar.

Note that to keep the old one intact, you’ll have to add:

<VirtualHost *>
DocumentRoot /www/
ServerName localhost
</VirtualHost>

as well.

image_pdfimage_print
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *