My way of doing virtual hosts for local testing

Problems with the Windows version of XAMPP, questions, comments, and anything related.

My way of doing virtual hosts for local testing

Postby Takster » 13. June 2010 06:11

Just something I tried I might as well share. 8)
If you want an easy way to layout your virtual hosts on a windows machine, and separate xampp completely from the folder that houses your websites, then this is the easy way to do it.
Say you have created a folder structure under C: called server. In this folder you will have subfolders making up the websites/scripts you are testing.

Code: Select all
C:/server
C:/server/wordpress
C:/server/vbulletin

These will be accessed like so:

Code: Select all
http://localhost.wordpress.com
http://localhost.wordpress.com



http://tak79.com/virtual-hosts-on-xampp-for-local-testing
User avatar
Takster
 
Posts: 13
Joined: 29. August 2006 10:18
Operating System: USB etch-a-sketch

Re: My way of doing virtual hosts for local testing

Postby Radzio » 13. June 2010 08:08

It's the same as with any OS (different paths though).
Code: Select all
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI

Are you really sure we need ExecCGI twice? I think once is enough :P
Code: Select all
http://localhost.wordpress.com

I wouldn't add subdomains to already existing domains. More preferable are short 1-part domains (as there will only appear locally): http://wordpress/ etc. (or with .localhost)
Code: Select all
127.0.0.1 localhost
127.0.0.1 localhost.main.com
127.0.0.1 localhost.wordpress.com
127.0.0.1 localhost.vbulletin.com

Better would be (still using your domains):
Code: Select all
127.0.0.1 localhost localhost.main.com localhost.wordpress.com localhost.vbulletin.com

I would also suggest using mod_vhost_alias. Then you can have this:
Code: Select all
VirtualDocumentRoot C:/server/%0
<Directory C:/server/*>
   Options ExecCGI Includes FollowSymLinks
   AllowOverride All
   Order allow,deny
   Allow from all
</Directory>

And then you don't have to restart Apache after adding new vhost. The only thing you need is to create a folder in C:/server with appropriate name and then add this name to the line with 127.0.0.1 in hosts file.
Radzio
 
Posts: 81
Joined: 05. June 2010 12:26

Re: My way of doing virtual hosts for local testing

Postby Takster » 14. June 2010 09:29

Thanks mate those are some really great improvements, mod_vhost_alias looks a lot better for my needs :)

thanks for spotting my mistake too hehe :oops:
User avatar
Takster
 
Posts: 13
Joined: 29. August 2006 10:18
Operating System: USB etch-a-sketch

Re: My way of doing virtual hosts for local testing

Postby Radzio » 14. June 2010 09:46

Takster wrote:Thanks mate those are some really great improvements, mod_vhost_alias looks a lot better for my needs :)

thanks for spotting my mistake too hehe :oops:

You are welcome :D
Radzio
 
Posts: 81
Joined: 05. June 2010 12:26


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 195 guests