Virtual hosts help for a noob

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

Virtual hosts help for a noob

Postby Takster » 30. August 2006 23:07

Hi there.

I have installed the latest xampp on my xp machine, i have no problems other then the fact i am a totally new to the whole 'virtual host' thing, i kinda got stuck and was hoping someone can tell me what i am doing wrong.

I followed a tutorial from the tutorial site, and tried to learn what i can from the various posts on the subject, i have one virtual host running okay, but how to enable more...this is where im stuck.

I want to have as many sites on localhost/virtualhost as possible, no outside internet connections or www.links, just all localhost testing websites for now.

I have my vhosts.conf like this:

Code: Select all
# Use name-based virtual hosting.
#

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot C:/xampp/xampp/htdocs
    ServerName localhost:80
    ServerAdmin admin@localhost
</VirtualHost>

<VirtualHost *:80>
ServerName localhost.main.com
ServerAlias localhost.main.com *.localhost.main.com
ServerAdmin admin@domain1.co.uk
DocumentRoot C:/srv/www/yourdomain
<Directory "C:/srv/www/yourdomain">
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName localhost.main2.com
ServerAlias localhost.main2.com *.localhost.main2.com
ServerAdmin admin@domain2.co.uk
DocumentRoot C:/srv/www/yourdomain2
<Directory "C:/srv/www/yourdomain2">
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


My 'hosts' file:
Code: Select all
127.0.0.1 localhost
127.0.0.1 yourdomain
127.0.0.1 yourdomain2


httpd.conf:
Code: Select all
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>


I can access localhost.main.com no problem, but how to setup the next virtual host has confused me i thought you make localhost.main2.com
or something similar??? thanks for any advice.
User avatar
Takster
 
Posts: 13
Joined: 29. August 2006 10:18
Operating System: USB etch-a-sketch

Postby Izzy » 30. August 2006 23:26

Maybe this is the issue.

ServerName localhost.main.com
127.0.0.1 yourdomain

Maybe it should be:
ServerName localhost.main.com
127.0.0.1 localhost.main.com

Or maybe this:
ServerName main.com
ServerAlias *.main.com
127.0.0.1 main.com


Also a small point but enclose all your paths in " "

"C:/xampp/xampp/htdocs"
"C:/srv/www/yourdomain"
etc.etc.

IMHO this is reducing the security of your server:
httpd.conf:
Code: Select all
Code:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

This a very restrictive default and should not be changed.
Code: Select all
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

You have done the correct thing in your Virtual Host Container:
Code: Select all
<Directory "C:/srv/www/yourdomain">
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Takster » 30. August 2006 23:39

Izzy wrote:Maybe this is the issue.

ServerName localhost.main.com
127.0.0.1 yourdomain

Maybe it should be:
ServerName localhost.main.com
127.0.0.1 localhost.main.com

Or maybe this:
ServerName main.com
ServerAlias *.main.com
127.0.0.1 main.com


Also a small point but enclose all your paths in " "

"C:/xampp/xampp/htdocs"
"C:/srv/www/yourdomain"
etc.etc.

IMHO this is reducing the security of your server:
httpd.conf:
Code: Select all
Code:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

This a very restrictive default and should not be changed.
Code: Select all
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

You have done the correct thing in your Virtual Host Container:
Code: Select all
<Directory "C:/srv/www/yourdomain">
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>


I followed your advice...and i had 100% success. It was the host file settings, yes.

Many thanks for the fast reply and helping me out. :D 8)
User avatar
Takster
 
Posts: 13
Joined: 29. August 2006 10:18
Operating System: USB etch-a-sketch


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 123 guests