Forum Moderators: phranque
ServerRoot "C:/apache2"
Listen 80
DocumentRoot "C:/apache2/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>
<Directory "C:/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
nameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin bbxrider@example.com
DocumentRoot "C:/apache2/htdocs/example2/"
DirectoryIndex index.html index.htm
ServerName www.example2.com
ServerAlias example2.com *.example2.com
ErrorLog C:/apache2/log/www.example2-error_log
# CustomLog C:/apache2/log/www.example2-access_log
</VirtualHost>
<VirtualHost *:80>
ServerAdmin bbxrider@example.com
DocumentRoot "C:/apache2/htdocs/"
DirectoryIndex index.html index.htm
ServerName www.example.com
ServerAlias example.com *.example.com
ErrorLog C:/apache2/log/www.example-error_log
# CustomLog C:/apache2/log/www.example2-access_log
</VirtualHost>
[edited by: jdMorgan at 10:30 pm (utc) on Mar. 14, 2007]
[edit reason] Example.com [/edit]
<VirtualHost 123.123.123.123:80>
With *:80, the results were unpredictable.
And welcome to Webmaster World!
[edited by: Bluesplinter at 11:36 pm (utc) on Mar. 14, 2007]
Open up a dos box and type ipconfig and see what your IP is. If your router assigns you an IP, it won't be the same as your external IP. Use the internal IP (probably starting with 192. but you might also use 127.0.0.1) for the vhost setting.
If you already know all that, or I misunderstood your setup, then sorry :)
1) My Listen has the full IP: Listen 123.123.123.123:80
This is because my box is also running IIS, and I have some IPs configured for IIS, and some for Apache, so I have to list the separate IPs. Probably not something that affects you, unless you also have IIS running on your box. Probability: LOW
2a) My NameVirtualHost uses IP (no port): 123.123.123.123
2b) My <VirtualHost 123.123.123.123:80>
We already discussed these, so not your problem. Probablility: NIL
3) My vhost DocumentRoot does NOT have a trailing slash. Yours do. Probability: HIGH ('cause there ain't nothin' left <g>).
So, remove the trailing slash and see if that helps. You might also try using parallel directories instead of a parent and child, ie:
DocumentRoot "C:/apache2/htdocs/example2"
DocumentRoot "C:/apache2/htdocs/example1"
I removed the trailing slashes for you :)
Also, make sure IIS is not installed (or is off). If none of this helps, you'll have to find someone smarter than me.
DocumentRoot "d:/apache2/htdocs/default"
And for the two vhosts:
DocumentRoot "d:/apache2/htdocs/example1"
DocumentRoot "d:/apache2/htdocs/example2"
IOW, put them in separate branches of the tree. Also, you didn't list your default NameVirtualHost setup... do you have one? Mine looks similiar to this:
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost 123.123.123.123:80>
ServerAdmin me@example.com
DocumentRoot "D:/Apache2/htdocs/default"
ErrorLog logs/dummy-host-error_log
CustomLog logs/dummy-host-access_log common
</VirtualHost>
It comes before any of the "real" vhost blocks. Try these suggestions, restart Apache, and see which directory actually feeds the requests.
this is my current setup, at least as far as directives for virtual host
i tried the DocumentRoot "C:/apache2/htdocs/default" and got an error msg on the restart that it must be a directory
ServerRoot "C:/apache2"
Listen 80
DocumentRoot "C:/apache2/htdocs"
<Directory "C:/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin bbxrider@example.com
DocumentRoot C:/apache2/htdocs/example2
DirectoryIndex index.html index.htm
ServerName www.example2.com
ServerAlias example2.com *.example2.com
ErrorLog C:/apache2/log/www.example2-error_log
# CustomLog C:/apache2/log/www.example2-access_log
</VirtualHost>
<VirtualHost *:80>
ServerAdmin bbxrider@example.com
DocumentRoot C:/apache2/htdocs/example
DirectoryIndex index.html index.htm
ServerName www.example.com
ServerAlias example.com *.example.com
ErrorLog C:/apache2/log/www.example-error_log
# CustomLog C:/apache2/log/www.example2-access_log
</VirtualHost>
i ran the httpd -S -w for the status of the current virt host setup, it looks ok to me:
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server www.example2.com (C:/apache2/conf/httpd.conf:228)
port 80 namevhost www.example2.com (C:/apache2/conf/httpd.conf:228)
port 80 namevhost www.example.com (C:/apache2/conf/httpd.conf:237)
Syntax OK
what i find really strange is that if apache has my default server being example2, how come i get the htdocs directory default page for example2.com and not the example2.com default page?
[edited by: jdMorgan at 3:54 pm (utc) on Mar. 16, 2007]
[edit reason] No URLs, please. See Terms of Service. [/edit]