Sounds easy enough, but where? A virtual host on the same server as my website seems logical enough, but I don't own the box it runs on, I get the space thanks to some generous friends and I didn't want to bug them for another favor to set up a virtual host.
Thinking about it I realized I was already running Apache on my laptop, so in theory could set up a virtual host on it. I could use /etc/hosts to create a "test hostname" pointing at my localhost I could use in URLs. So that's what I went about doing.
First, I added an entry to /etc/hosts:
$grep test.vwelch.com /etc/hostsThen I added the virtual host entry for test.vwelch.com to my Apache configuration so that it would recognize URLs using it and serve content from a separate location that it normally would. This is on a Mac, so the details here might vary based on your OS, but if you search for "virtual host configuration" and the name of your OS I suspect you'll find help.
127.0.0.1 test.vwelch.com
$ cat /etc/apache2/other/vwelch.confThen I checked out a copy of my website from my git repository into /usr/local/www, restarted Apache ("apachectl restart") and pointed my web browser at "http://test.vwelch.com" and I had a complete copy of my website in a local playground that I could develop on.
NameVirtualHost test.vwelch.com
ServerName test.vwelch.com
DocumentRoot /usr/local/www/
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
No comments:
Post a Comment