Forum Moderators: phranque

Message Too Old, No Replies

namebased virtual hosting

namebase virtual hosting

         

JesterJoker

7:36 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Sorry for being an idiot about this but im really having trouble doing namebased virtual hosting, im using a XAMPP install on one of my drives my G:

so at the momment my document root says
DocumentRoot "G:/apachefriends/xampp/htdocs"

and when im trying to set my virtual hosts up i have a setup like this

<VirtualHost example.com>
ServerAdmin admin@example.com
DocumentRoot G:/apachefriends/xampp/htdocs/example
ServerName example.com
ErrorLog logs/example-error_log
CustomLog logs/example-access_log common
</VirtualHost>

<VirtualHost example2.com>
ServerAdmin admin@example2.com
DocumentRoot G:/apachefriends/xampp/htdocs/example2
ServerName example2.com
ErrorLog logs/example2-error_log
CustomLog logs/example2-access_log common
</VirtualHost>

when i type either of the urls it brings me to my documentroot and shows my 2 folders

example
and
example2

I have my listen set at

Listen 80

and server name set at

ServerName 10.0.0.100 (my internal network ip address)

ive used slackware 10 and done this but using xampp it doesnt seem to work ..
all help would be appreciated.

[edited by: jdMorgan at 3:56 am (utc) on Mar. 19, 2005]
[edit reason] Examplified. [/edit]

sitz

8:39 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Anything in your error logs?

JesterJoker

8:59 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



i dont really know what log im supposed to be looking in theres a bunch of random stuff from when i have been forcing restarts on it . to test changes

<snip>

hope that helps

[edited by: jdMorgan at 11:00 pm (utc) on Mar. 19, 2005]
[edit reason] Removed URL per TOS. [/edit]

sitz

9:33 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Are you using a NameVirtualHost directive ([httpd.apache.org ]) which matches your <VirtualHost> blocks? I don't see one in the config snippet you posted.

JesterJoker

9:38 pm on Mar 19, 2005 (gmt 0)

10+ Year Member



isnt that what the * stands for in?

the code

NameVirtualHost *

<VirtualHost *>
ServerAdmin admin@example.com
DocumentRoot G:/apachefriends/xampp/htdocs/example
ServerName example.com
ErrorLog logs/example-error_log
CustomLog logs/example-access_log common
</VirtualHost>

<VirtualHost *>
ServerAdmin admin@example2.com
DocumentRoot G:/apachefriends/xampp/htdocs/example2
ServerName example2.com
ErrorLog logs/example2-error_log
CustomLog logs/example2-access_log common
</VirtualHost>

sitz

4:44 am on Mar 20, 2005 (gmt 0)

10+ Year Member



Number 1: Check your logs; the answers (or at least the problems) are almost invariably there. The path to the error log is defined using the ErrorLog directive in your httpd.conf (or apache.conf, if that's what you use).

JesterJoker

5:48 am on Mar 20, 2005 (gmt 0)

10+ Year Member



I got it fixed, i messed with it.. i fixed the part where it was referencing

ServerName localhost
and left it like that with no ipaddress and it seemed to fix the problem, except i have to fix the error log reporting i kind of took that part out for now

haha but it works and i have multiple domains on the same ip again working fine

oops i also did a common problem i didnt define

my final setup that worked was

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com
DocumentRoot "G:/apachefriends/xampp/htdocs/domain1"
ServerAdmin admin@domain1.com
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.com
ServerAlias domain2.com
DocumentRoot "G:/apachefriends/xampp/htdocs/domain2"
ServerAdmin admin@domain2.com
</VirtualHost>