Forum Moderators: phranque
I have been trying to work around this problem for days and am about to give up and do something else.
My problem is I have 2 websites w/2 registered domains. I have virtualhosts setup up but no matter what I do it always brings up the apache default index.html.
I have created seperate directories,index files and logs. No matter using :80, *, etc all to no avail. I have even tried deleting the default index.html and renaming it. I have used index.html and example.html in the directories to no avail.
If I restart I get no errors. If I go to my websites via the web I get no errors. Everything works fine except the individual index.htmls.
Biggest problem is in all the hundreds of problems like this on a google search no one has a solution that is posted.
Here is my httpd.conf. Thanks in advance:
Listen 80
ServerRoot "C:/Apache"
DocumentRoot "C:/Apache/htdocs"
ServerAdmin datapros@our_hosting.net
ServerName 216.51.***.136
NameVirtualHost 216.51.***.136
<VirtualHost 216.51.***.136>
ServerName example.com
ServerAdmin datapros@our_hosting.net
DocumentRoot c:/example
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
<VirtualHost 216.51.***.136>
ServerName example2.com
ServerAdmin datapros@our_hosting.net
DocumentRoot c:/example2
DirectoryIndex index.html
</VirtualHost>
[edited by: jdMorgan at 1:28 am (utc) on Dec. 9, 2006]
[edit reason] No URLs or IPs, please. See TOS. [/edit]
Your directives and containers appear to be misconfigured. See the example given in the Apache Name-Based Virtual Hosts documentation [httpd.apache.org].
Jim
I tried exactly like the manual that was written for linux/unix.
Same thing.
I tried it with just example under apache and under apache/htdocs. same thing.
Same problem persists.
Listen 80
ServerRoot "C:/Apache"
DocumentRoot "C:/Apache/htdocs"
ServerAdmin datapros@our_hosting.net
ServerName 216.51.***.136
NameVirtualHost 216.51.***.136
<VirtualHost 216.51.***.136>
ServerName example.com
ServerAdmin datapros@our_hosting.net
DocumentRoot /example
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
<VirtualHost 216.51.***.136>
ServerName example2.com
ServerAdmin datapros@our_hosting.net
DocumentRoot /example2
DirectoryIndex index.html
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
[edited by: jdMorgan at 1:23 am (utc) on Dec. 9, 2006]
[edit reason] No URLs, IPs. See Terms of Service. [/edit]
For some reason contrary to the manual my setup only works with an * instead of my ip address.
If you change to an * with out a directory directive you get a permissions error. By making a directory directive "correctly" it will pass you to your correct index.html.
In this example I have not tweaked it yet for security, so beware!
Listen 80
ServerRoot "C:/Apache"
DocumentRoot "C:/Apache/htdocs"
ServerAdmin datapros@our-hosting.net
ServerName 216.51.***.136
NameVirtualHost *
<VirtualHost *>
ServerName www.example.com
ServerAdmin datapros@our-hosting.net
DocumentRoot /example
DirectoryIndex index.html
ErrorLog /example/logs/error_log
CustomLog /example/logs/access_log common
</VirtualHost>
<VirtualHost *>
ServerName www.example2.com
ServerAdmin datapros@our-hosting.net
DocumentRoot /example2
DirectoryIndex index.html
ErrorLog /example2/logs/error_log
CustomLog /example2/logs/access_log common
</VirtualHost>
# notice example does not have a "/" in front of it!
<Directory example>
Options FollowSymLinks
AllowOverride All
#None
Order allow,deny
#deny,allow
# Deny from all
Satisfy all
</Directory>
# notice example2 does not have a "/" in front of it!
<Directory example2>
Options FollowSymLinks
AllowOverride All
#None
Order allow,deny
#deny,allow
# Deny from all
Satisfy all
</Directory>
[edited by: jdMorgan at 4:09 pm (utc) on Dec. 9, 2006]
[edit reason] Obscured URLs, IPs & e-mail per TOS. [/edit]