Page 1 of 1

VirtualHost Problems

PostPosted: 06. June 2006 19:58
by nebraskadad
All,

I am attempting to setup virtuals under XAMPP.

I've define the records in DNS and the server replies correctly

The Include Directive is pointing to "extra/httpd-vhosts.conf"

I've attempted to add the following the httpd-vhosts.conf


<VirtualHost www2.domain.org:80>
ServerName www2.domain.org
DocumentRoot "C:/opt/xampp/htdocs/www2"
ErrorLog "C:/opt/xampp/apache/logs/www2error80.log"
</VirtualHost>


<VirtualHost www3.domain.org:80>
ServerName www3.domain.org
DocumentRoot "C:/opt/xampp/htdocs/www3"
ErrorLog "C:/opt/xampp/apache/logs/www3error80.log"
</VirtualHost>


I've tried it this way as well


<VirtualHost *:80>
ServerName www2.domain.org
DocumentRoot "C:/opt/xampp/htdocs/www2"
ErrorLog "C:/opt/xampp/apache/logs/www2error80.log"
</VirtualHost>

To no avail..


When I do this edit and attempt to restart apache apache fails to start..

Any insight appreciated..

PostPosted: 07. June 2006 17:07
by tomfmason
Are you running this server behind a router. If so you should try some thing more like this
Code: Select all
NameVirtualHost 192.168.00.00    //what ever your local ip is
NameVirtualHost 70.00.00.00                //what ever your wan ip is

<VirtualHost 192.168.00.00 70.00.00.00>
DocumentRoot C:/opt/xampp/htdocs/www2/domain2
ServerName domain2.org
ServerAlias domain
</VirtualHost>


I think this link should be helpfull http://httpd.apache.org/docs/1.3/vhosts/examples.html

Good luck

PostPosted: 08. June 2006 20:09
by WorldDrknss
here is an example of running two VirtualHost:
You can find a VirtualHost Generator at my website.

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
#
# 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 *:80

#
# 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 block.
#

<VirtualHost *:80>
ServerName test1.com
ServerAdmin test@test1.com
ServerAlias www.test1.com
DocumentRoot /srv/www/test1
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/srv/www/test1">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/srv/www/test1">
Options Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddHandler server-parsed .html .htm .shtml .shtm
</Directory>
HostnameLookups Off
ErrorLog /srv/www/test1/logs/error_log
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /srv/www/test1/logs/access_log combined
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/test1/cgi-bin/"
<Directory "/srv/www/test1/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php
ErrorDocument 400 /error_pages/400.html
ErrorDocument 403 /error_pages/403.html
ErrorDocument 404 /error_pages/404.html
AccessFileName .htaccess
AddHandler cgi-script .cgi
<IfModule mod_negotiation.so>
<IfModule mod_include.so>
Alias /error/ "/srv/www/test1/error/"
<Directory "/srv/www/test1/error">
AllowOverride None
Options IncludesNoExec
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en
</Directory>
</IfModule>
</IfModule>
</VirtualHost>

<VirtualHost *:80>
ServerName test2.com
ServerAdmin test@test2.com
ServerAlias www.test2.com
DocumentRoot /srv/www/test2
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/srv/www/test2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/srv/www/test2">
Options Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddHandler server-parsed .html .htm .shtml .shtm
</Directory>
HostnameLookups Off
ErrorLog /srv/www/test2/logs/error_log
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /srv/www/test2/logs/access_log combined
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/test2/cgi-bin/"
<Directory "/srv/www/test2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php
ErrorDocument 400 /error_pages/400.html
ErrorDocument 403 /error_pages/403.html
ErrorDocument 404 /error_pages/404.html
AccessFileName .htaccess
AddHandler cgi-script .cgi
<IfModule mod_negotiation.so>
<IfModule mod_include.so>
Alias /error/ "/srv/www/test2/error/"
<Directory "/srv/www/test2/error">
AllowOverride None
Options IncludesNoExec
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en
</Directory>
</IfModule>
</IfModule>
</VirtualHost>

<VirtualHost *:80>
ServerName localhost
DocumentRoot /xampp/xampp/htdocs
</VirtualHost>