Virtual Host in xampp

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

Virtual Host in xampp

Postby mahes » 24. June 2009 12:01

Hi all,

How we can create virtual directories/host using xampp. Am used below code for two projects but url is redirected into only one directory

Code: Select all
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:8090

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    DocumentRoot /www/docs/dummy-host2.example.com
##    ServerName dummy-host2.example.com
##    ErrorLog @rel_logfiledir@/dummy-host2.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host2.example.com-access_log common
##</VirtualHost>
<VirtualHost *:8090>
ServerName http://xxxxdemo.no-ip.biz
DocumentRoot "C:/Program Files/xampp/htdocs/xxxxdemo"
<Directory "../xxxxdemo">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
CustomLog "C:/Program Files/xampp/htdocs/xxxxdemo/xx_access.log" combined
ErrorLog "C:/Program Files/xampp/htdocs/xxxxdemo/xx_error.log"
LogLevel error
</VirtualHost>
<VirtualHost *:8090>
ServerName http://xxxxdemo1.no-ip.biz
DocumentRoot "C:/Program Files/xampp/htdocs/xxxxdemo1"
<Directory "../xxxxdemo1">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow From All
</Directory>
CustomLog "C:/Program Files/xampp/htdocs/xxxxdemo1/xx_access.log" combined
ErrorLog "C:/Program Files/xampp/htdocs/xxxxdemo1/xx_error.log"
LogLevel error
</VirtualHost>


Both url's redirects into demo directory.....
mahes
 
Posts: 20
Joined: 04. February 2008 10:47

Re: Virtual Host in xampp

Postby Wiedmann » 24. June 2009 12:14

Code: Select all
ServerName http://xxxxdemo.no-ip.biz

That's not a valid value for "ServerName":
http://httpd.apache.org/docs/2.2/mod/core.html#servername
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Virtual Host in xampp

Postby mahes » 24. June 2009 12:17

For some reason i putted xxxxdemo.no-ip.com..

I can access these sites through internet wht problem in both url's (xxxxdemo.no-ip.bix,xxxxdemo1.no-ip.zip) redirects into one dir that is xxxxdemo.
Last edited by mahes on 24. June 2009 12:23, edited 1 time in total.
mahes
 
Posts: 20
Joined: 04. February 2008 10:47

Re: Virtual Host in xampp

Postby Wiedmann » 24. June 2009 12:20

For some reason i putted xxxxdemo.no-ip.com

You mean you have:
Code: Select all
ServerName xxxxdemo.no-ip.biz

:?:

Code: Select all
<Directory "../xxxxdemo">

This should also be the same as your "DocumentRoot".
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Virtual Host in xampp

Postby mahes » 24. June 2009 12:25

yes am also tried what you said... but not get suceeded
mahes
 
Posts: 20
Joined: 04. February 2008 10:47

Re: Virtual Host in xampp

Postby Wiedmann » 24. June 2009 12:50

I can access these sites through internet wht problem in both url's (xxxxdemo.no-ip.bix,xxxxdemo1.no-ip.zip)

I can't access non of them...
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Virtual Host in xampp

Postby Wiedmann » 24. June 2009 13:15

(xxxxdemo.no-ip.bix,xxxxdemo1.no-ip.zip)

There is frameset at both URIs. and the target frame for both framesets is the same ip/port.
--> so you can't use namebased virtualhosts.

If you can change the target port for one of the URIs, you can use 2 ip based vhosts (with different ports).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Virtual Host in xampp

Postby mahes » 24. June 2009 14:59

Hi Wiedmann,

Thanks for the info. Am blind in that area, can you give some clue to how to do muliple ports for multiple domains.....
mahes
 
Posts: 20
Joined: 04. February 2008 10:47

Re: Virtual Host in xampp

Postby Wiedmann » 24. June 2009 16:07

can you give some clue to how to do muliple ports for multiple domains.....

- remove the "NameVirtualHost" directive
- in the two "VirtualHost" directives, replace the "*" with "_default_"
- use different ports in each "VirtualHost" directive.

(setup your domain config at no-ip to use different ports)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Virtual Host in xampp

Postby mnem0 » 29. August 2009 13:27

Hi,

i have quite the same problem, i haven't found a solution yet.
i set up two virtualhosts on my xampp like this :

Code: Select all
<VirtualHost 94.23.66.223:80>
ServerName tapalair.net
ServerAlias www.tapalair.net
DocumentRoot "C:/xampp/htdocs/tapalair-net"
ServerAdmin webmaster@tapalair.net
ErrorLog logs/tapalair_net.log
CustomLog logs/tapalair_net_access.log common
LogLevel error
</VirtualHost>

<VirtualHost 94.23.66.223:80>
ServerName tapalair.net
ServerAlias elr0y.tapalair.net
DocumentRoot "C:/xampp/htdocs/tapalair-net/elr0y"
ServerAdmin webmaster@tapalair.net
ErrorLog logs/tapalair_net.log
CustomLog logs/tapalair_net_access.log common
LogLevel error
</VirtualHost>


when i try to access elr0y.tapalair.net, i get http://www.tapalair.net's index page :/
i really need to have these vhosts configured with the same ip adress.

Could anyone help me please ?
regards,
mnem0
mnem0
 
Posts: 12
Joined: 16. May 2008 19:32

Re: Virtual Host in xampp

Postby Nobbie » 29. August 2009 14:21

You need to configure a NameBased VirtualHost, your configuration lacks the "NameVirtualHost" Directive. See http://httpd.apache.org/docs/2.2/en/vho ... based.html
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Virtual Host in xampp

Postby mnem0 » 29. August 2009 15:08

thank you very much Nobbie,

that was a quick solution to my problem, everything is ok now, you saved me a lot of time.
have a nice day.
regards,
mnem0
mnem0
 
Posts: 12
Joined: 16. May 2008 19:32


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 149 guests