Results 1 to 5 of 5
Hello,
so I have two sites, first.site.com and second.site.com and I am attempting to serve them both from the same server. Currently I have two the virtual hosts setup as ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-28-2005 #1Just Joined!
- Join Date
- Jun 2005
- Posts
- 70
virtual hosts!
Hello,
so I have two sites, first.site.com and second.site.com and I am attempting to serve them both from the same server. Currently I have two the virtual hosts setup as follows:
Now they are being served, they just are not being served correctly. If I go to first.site.com, a apache server config page comes up saying apache running correctly. But if i goto first.site.com/site1 the site is served as if it is starting from the beginning of the site. So, it seems that the documentroot is not being set properly in the <virtual host> directives. I have removed the documentroot directive from the conf file (from outside of the <virtualhost> directives) and also the servername directive.Code:NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/html/site1 <Directory "/var/www/html/site1/"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> ServerName first.site.com ErrorLog logs/site1 CustomLog logs/site1 common </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html/site2 <Directory "/var/www/html/site2/"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> ServerName second.site.com ErrorLog logs/site2 CustomLog logs/site2 common </VirtualHost>
I am puzzled and have been working on this for about a day. Anyone have any idea?
- 07-28-2005 #2Just Joined!
- Join Date
- May 2005
- Posts
- 52
I had similar problems. I made a default deny VH first. Here part of mine, simplified.
# First Virtual Host denies access to anyone
# asking for a non-existant VH. Then, VHs specified.
#
NameVirtualHost *:80
<VirtualHost *:80>
ServerName default.only
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/site1"
ServerName site1.domain.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/site2"
ServerName www.site2.domain.com
</VirtualHost>
- 07-28-2005 #3Linux Newbie
- Join Date
- Apr 2003
- Location
- Pontypridd, Wales
- Posts
- 104
Not sure what you mean? Please explain.But if i goto first.site.com/site1\"One World, One Web, One Program.\" -- Advertisement for Internet Explorer.
\"Ein Volk, Ein Reich, Ein Fuehrer.\" -- Adolf Hitler.
- 07-29-2005 #4Just Joined!
- Join Date
- May 2005
- Posts
- 52
I took it to mean that the default apache site, or whatever site is configured as the first VH always comes up, wether he goes to www.site1.domain.com or www.site2.domain.com
- 07-29-2005 #5Just Joined!
- Join Date
- May 2005
- Posts
- 52
just try this first in your vhost.conf
<VirtualHost *:80>
ServerName default.only
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>


Reply With Quote
