XAMP Virtual Hosting Of Sub Domains

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

XAMP Virtual Hosting Of Sub Domains

Postby TheBarEnd » 12. April 2007 05:19

Hi all

After being able to work out everything from docs I have come to a pass where I am not sure what to do. :shock:

Background
Currently running XAMPP for Windows Version 1.6.0a
Running windows XP Professional (SP2)
XAMPP is running on Drive D (Main Drive is C)
Have been through forum and tried help options to no avail.
Running 4 subdomains

Office.businesscogs.com.au (located http://office.businesscogs.com.au)

Barend.businesscogs.com.au (located http://office.businesscogs.com.au/thebarend)

dcp.businesscogs.com.au (located http://office.businesscogs.com.au/dcp)

vvcmcc.businesscogs.com.au (located http://office.businesscogs.com.au/vvcmc)

I have added the prefix of each in my DNS account with all addresses pointing at my static ip address

When I've used the instructions to create virtual hosting for each the pages can not be found. Switch virtual hosting off and low and behold there back (have to type the full address).

The following is the coding of my vhost config file (showing two entries - I gather we get this right and then its just a case of mirroring)

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 <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster@businesscogs.com.au
DocumentRoot "D:/Servers/xampp/htdocs/"
DirectoryIndex index.html index.htm
ServerName office.businesscogs.com.au
ServerAlias office.businesscogs.com.au
ErrorLog D:/Servers/xampp/apache/businesscogs-error_log
CustomLog D:/Servers/xampp/apache/logs/businesscogs-log_common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@businesscogs.com.au
DocumentRoot "D:/Servers/xampp/htdocs/dcp"
DirectoryIndex Index.html Index.htm
ServerName dcp.businesscogs.com.au
ErrorLog D:/Servers/xampp/apache/dcp-error_log
CustomLog D:/Servers/xampp/apache/logs/dcp-log_common
</VirtualHost>

In looking at the main config file the user docs point to the my documents file on C drive. Has this something to do with it?

Is there something I should be doing around Alias's?

What am I doing wrong. Would love to get virtual hosting working soooo much.

Thanking you all for your help.

Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby Wiedmann » 12. April 2007 05:30

The following is the coding of my vhost config file

Looks good.

When I've used the instructions to create virtual hosting for each the pages can not be found.

Can you explain this more detailed?
- error message
- error log
- ...
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Error

Postby TheBarEnd » 12. April 2007 07:18

Thanks for the quick response Wiedmann

Have run - s and the following appears:
____________________________

Syntax error on line 34 (log line)

Customlog takes two or three arguments, a file name, a custom log format string or format name, and an optional "env=" clause

Apache could not be started

_____________________________

Does this help at all

Cheers
Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby Wiedmann » 12. April 2007 07:24

Customlog takes two or three arguments,

Ah, right. Sorry.

CustomLog D:/Servers/xampp/apache/logs/businesscogs-log_common

From the Apache-Manual:
Syntax: CustomLog file format [environment-variable]

Maybe you must add a format like "common" or remove the underscore ("_").
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Got It

Postby TheBarEnd » 12. April 2007 07:45

Mate thank you - you were on the right track but had to make a little change

CustomLog D:/Servers/xampp/apache/logs/businesscogs.log common

1: Hyphen removed and replaced with a full stop (period) after business
2: Underscore replaced after log with a space for the log format.

:D :D :D

Did the same to the error log line. That is .log instead of _log.

The amount of time I have worked on this is incredible. All down to the learning curve :lol:

My many thanks Wiedmann

For others reading this - the formats I used initially came from another help file here ages ago. If you come across it remember my lesson. :) Or maybe it was I case I can not read :oops:

Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby WorldDrknss » 12. April 2007 07:52

Your Vhost are incorrect and should contain the minimal settings similar below:
Code: Select all
<VirtualHost *:80>
ServerName dcp.businesscogs.com.au
ServerAlias www.dcp.businesscogs.com.au
ServerAdmin webmaster@businesscogs.com.au
DocumentRoot D:/Servers/xampp/htdocs/dcp
ErrorLog           "D:/Servers/xampp/apache/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          "D:/Servers/xampp/apache/logs/access.log" combined
<Directory "D:/Servers/xampp/htdocs/dcp">
Options ExecCGI Includes FollowSymLinks
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Postby TheBarEnd » 12. April 2007 08:16

Thanks WorldDrkness

I can see what you are saying in the log format lines. However, as I wish to use a seperate log for each sub domain as far as I can see I need to include a reference path for each one.

You have also added a few lines which include CGI. Why are these required? Are these not already set in the main config file?

Looking forward to hearing back.

Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby WorldDrknss » 13. April 2007 02:22

I just prefer to have all the configurations for each Vhost seperate as it easy allows me to make changes to a specific host instead of overall.

An example of a VirtualHost I would use looks like:
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 *: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 <VirtualHost> block.
#
<VirtualHost *:80>
ServerName thegamerslounge.game-host.org
ServerAdmin WorldDrknss@thegamerslounge.game-host.org
ServerAlias www.thegamerslounge.game-host.org
DocumentRoot "/srv/www/thegamerslounge"
<Directory "/srv/www/thegamerslounge">
Options            Indexes FollowSymLinks Includes ExecCGI
AllowOverride      All
Order              allow,deny
Allow              from all
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddHandler server-parsed .html .htm .shtml .shtm
</Directory>
<Directory "/srv/www/thegamerslounge/logs">
Deny from all
</directory>
HostnameLookups    Off
ErrorLog           "/srv/www/thegamerslounge/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/thegamerslounge/logs/access.log" combined
ServerSignature    On
ScriptAlias        /cgi-bin/  "/srv/www/thegamerslounge/cgi-bin/"
<Directory "/srv/www/thegamerslounge/cgi-bin">
AllowOverride      None
Options            None
Order              allow,deny
Allow              from all
</Directory>
DirectoryIndex     index.php index.html index.htm index.shtml index.shtm
AccessFileName     .htaccess
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
AddHandler         cgi-script .cgi
<IfModule mod_negotiation>
<IfModule mod_include>
Alias /errors/ "/srv/www/thegamerslounge/errors/"
<Directory "/srv/www/thegamerslounge/errors">
AllowOverride None
Options IncludesNoExec
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en
</Directory>
</IfModule>
</IfModule>
ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 405 /errors/405.html
ErrorDocument 408 /errors/408.html
ErrorDocument 410 /errors/410.html
ErrorDocument 411 /errors/411.html
ErrorDocument 412 /errors/412.html
ErrorDocument 413 /errors/413.html
ErrorDocument 414 /errors/414.html
ErrorDocument 415 /errors/415.html
ErrorDocument 500 /errors/500.html
ErrorDocument 501 /errors/501.html
ErrorDocument 502 /errors/502.html
ErrorDocument 503 /errors/503.html
ErrorDocument 506 /errors/506.html
</VirtualHost>

<VirtualHost *:80>
ServerName localhost
DocumentRoot "/server/apache/htdocs"
</VirtualHost>

VirtualHost Generator: http://wdguides.org/gusion.php?name=gen ... irtualhost
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Logic

Postby TheBarEnd » 13. April 2007 03:07

Hi again WorldDrknss

Thanks for that. I can see were your logic is coming from and can see the advantage a little bit more coding can add. Will apply your philosopy one stage at a time over the weekend (Friday afternoon here now).

Will let you know how it goes.
Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby WorldDrknss » 13. April 2007 03:18

As a heads up for using this extensive VirtualHost, each VirtualHost must contain the cgi-bin, errors, and logs folders before apache will start/restart. As many times I tell people they need those folders in their respective location they seem to never create them and ask why apache wont start later on.

If you run into any problems please feel free to IM on AIM, Yahoo, or MSN.
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

TY

Postby TheBarEnd » 13. April 2007 03:23

thanks mate - will definately keep that in mind and yes - will yell if I get stuck - thanks

Cheers
Edward
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby Wiedmann » 13. April 2007 03:56

each VirtualHost must contain the cgi-bin, errors, and logs folders before apache will start/restart.

No.

But if you define such things in your vhost config, the folders must exists on your harddisk or the Apache start fails.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

No.

Postby TheBarEnd » 13. April 2007 04:06

Yes - understand Wiedmann - thanks
TheBarEnd
TheBarEnd
 
Posts: 8
Joined: 12. April 2007 04:52
Location: Canberra, Australia

Postby WorldDrknss » 13. April 2007 04:38

Wiedmann wrote:
each VirtualHost must contain the cgi-bin, errors, and logs folders before apache will start/restart.

No.

But if you define such things in your vhost config, the folders must exists on your harddisk or the Apache start fails.


Yes Wiedmann I was refering the example of the VirtualHost I posted which defines such folders. Also in which TheBarEnd is going to attempt, that is why I gave that to him as a heads up.
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 112 guests