This is a discussion on Apache 2.0 Virtual Hosts within the Linux Web Servers forums, part of the Web Server and Related Forums category; OK.. can't seem to get Virtual Hosts to work.. All requests are going to the first listed "VirtualHost&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
OK.. can't seem to get Virtual Hosts to work.. All requests are going
to the first listed "VirtualHost" no matter what domain is requested. httpd.conf file excerpts below... __________________________________________ Listen 80 DocumentRoot "/var/www/html/" # # Use name-based virtual hosting. # NameVirtualHost *:80 # Virtual host domain1.com <VirtualHost *> DocumentRoot /var/www/html/domain1 ServerName www.domain1.com </VirtualHost> <VirtualHost *> DocumentRoot /var/www/html/domain1/domain2 ServerName www.domain2.com </VirtualHost> ___________________________________________ no matter what you request (domain1.com OR domain2.com) it'll always go to domain1.com. If I reverse the order of the two sections (i.e. put domain2.com above domain1.com) then all requests go to domain2.com Am I missing something easy here?? Please help! |
|
|||
|
On 16 Jul 2003 20:00:46 -0700, The Other Guy responded to a post from
todd91x@hotmail.com (Todd) who wrote in comp.infosystems.www.servers.unix: >OK.. can't seem to get Virtual Hosts to work.. All requests are going >to the first listed "VirtualHost" no matter what domain is requested. > >httpd.conf file excerpts below... >__________________________________________ >Listen 80 >DocumentRoot "/var/www/html/" ># ># Use name-based virtual hosting. ># >NameVirtualHost *:80 ># Virtual host domain1.com ><VirtualHost *> > DocumentRoot /var/www/html/domain1 > ServerName www.domain1.com ></VirtualHost> ><VirtualHost *> > DocumentRoot /var/www/html/domain1/domain2 > ServerName www.domain2.com ></VirtualHost> >___________________________________________ > >no matter what you request (domain1.com OR domain2.com) it'll always >go to domain1.com. If I reverse the order of the two sections (i.e. >put domain2.com above domain1.com) then all requests go to domain2.com > >Am I missing something easy here?? Please help! Try using the ServerAlias Directive: http://httpd.apache.org/docs-2.0/mod...ml#serveralias <VirtualHost *> DocumentRoot /var/www/html/domain1 ServerName www.domain1.com ServerAlias doamain1.com </VirtualHost> <VirtualHost *> DocumentRoot /var/www/html/domain1/domain2 ServerName www.domain2.com ServerAlias domain2.com </VirtualHost> cf. http://httpd.apache.org/docs-2.0/vhosts/name-based.html http://httpd.apache.org/docs-2.0/vhosts/ HTH TOG -- ../configure --prefix=~/zyterion Not this guy or that guy, The Other Guy. This spot may contain a satirical comment or comedic source, and is meant to be funny. If you are easily offended, gullible or don't have a sense of humour we suggest you read elsewhere. |
|
|||
|
The Other Guy <nospam@this.addy> wrote in message news:<016chvko9tveorfk3tt6las3hjfpkkiclt@4ax.com>. ..
> On 16 Jul 2003 20:00:46 -0700, The Other Guy responded to a post from > todd91x@hotmail.com (Todd) who wrote in > comp.infosystems.www.servers.unix: > > >OK.. can't seem to get Virtual Hosts to work.. All requests are going > >to the first listed "VirtualHost" no matter what domain is requested. > > > >httpd.conf file excerpts below... > >__________________________________________ > >Listen 80 > >DocumentRoot "/var/www/html/" > ># > ># Use name-based virtual hosting. > ># > >NameVirtualHost *:80 > ># Virtual host domain1.com > ><VirtualHost *> > > DocumentRoot /var/www/html/domain1 > > ServerName www.domain1.com > ></VirtualHost> > ><VirtualHost *> > > DocumentRoot /var/www/html/domain1/domain2 > > ServerName www.domain2.com > ></VirtualHost> > >___________________________________________ > > > >no matter what you request (domain1.com OR domain2.com) it'll always > >go to domain1.com. If I reverse the order of the two sections (i.e. > >put domain2.com above domain1.com) then all requests go to domain2.com > > > >Am I missing something easy here?? Please help! > > Try using the ServerAlias Directive: > http://httpd.apache.org/docs-2.0/mod...ml#serveralias > > <VirtualHost *> > DocumentRoot /var/www/html/domain1 > ServerName www.domain1.com > ServerAlias doamain1.com > </VirtualHost> > <VirtualHost *> > DocumentRoot /var/www/html/domain1/domain2 > ServerName www.domain2.com > ServerAlias domain2.com > </VirtualHost> > > cf. http://httpd.apache.org/docs-2.0/vhosts/name-based.html > http://httpd.apache.org/docs-2.0/vhosts/ > > HTH > TOG Thanks TOG... but that's still producing the same results. This is really killing me.. I've looked through all the docs and my Virtual Hosts section is exactly what the docs say it should be. The only thing I can think of is maybe there's a different part that's wrong? But it all looks the same as well... I've seen posts from various people here who have the "NameVirtualHost" look like mine: NameVirtualHost *:80 ... but I've also seen: NameVirtualHost * For me.. the later produces an error "Bad Request" no matter what domain is requested. So it "works" with the :80... but won't go past the 1st virtual host. |