You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Blomstrom <da...@yahoo.com> on 2004/06/09 01:06:18 UTC

[users@httpd] Virtual Hosts - What am I doing wrong?

I thought I had successfully set up virtual hosts, but
it can't be right, because the php include links below
won't work without the extra path segment (../):

<?php
$_SERVER['DOCUMENT_ROOT'] .= '/freedomware';
include
($_SERVER['DOCUMENT_ROOT']."/../includes/head.php");
?>
</head>
<body>
<?php include
($_SERVER['DOCUMENT_ROOT']."/../includes/top.php"); ?>

The last line SHOULD read <?php include
($_SERVER['DOCUMENT_ROOT']."/includes/top.php"); ?>,
right?

But I can't figure out what I did wrong. Let's start
with my set up. Below are all the relevant paths\

C:/xampp/apache/
C:/xampp/htdocs/
C:/sites/mysites

Below are the first few entries on my httpd conf file:

<VirtualHost 127.0.0.1>
ServerAdmin admin@localhost
DocumentRoot "c:/sites"
ServerName localhost
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common
</VirtualHost>

<VirtualHost 127.0.0.1>
ServerAdmin webmaster@1
DocumentRoot "c:/sites/1"
ServerName 1
ServerAlias *.1
ErrorLog logs/1-error.log
ScriptAlias /cgi-bin/ "c:/sites/1/cgi-bin/"
<Directory "c:/sites/1">
Options All Includes Indexes
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1>
ServerAdmin webmaster@geobop
DocumentRoot "c:/sites/geobop"
ServerName geobop
ServerAlias *.geobop
ErrorLog logs/geobop-error.log
ScriptAlias /cgi-bin/ "c:/sites/geobop/cgi-bin/"
<Directory "c:/sites/geobop">
Options All Includes Indexes
</Directory>
</VirtualHost>

For some reason, c:/sites/1 doesn't work, but all my
other sites work. For example, I can preview
c:/sites/geobop at http://geobop/ But the include
links require that extra ../

It occurred to me that the first block of code might
not belong, so I deleted it...

<VirtualHost 127.0.0.1>
ServerAdmin admin@localhost
DocumentRoot "c:/sites"
ServerName localhost
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common
</VirtualHost>

Now, if I type in http://geobop/, http://freedomware/
or any other site, I get a different page; it appears
to be the index page in the folder sites.

So what am I doing wrong? I don't mind include links
with an extra ../. They appear to work both locally
and online. I'm just concerned that I'll eventually
run into trouble if they're incorrect.

Thanks.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts - What am I doing wrong?

Posted by David Blomstrom <da...@yahoo.com>.
Oops...ignore that last post. I just made a dumb
mistake; I discovered that I inadvertently erased the
line NameVirtualHost 127.0.0.1:80

Everything's now back to normal. Thanks.



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts - What am I doing wrong?

Posted by David Blomstrom <da...@yahoo.com>.
--- Tim Burden <Ti...@Burden.ca> wrote:
> No, I'm saying your vhosts are probably OK, but the
> reason your includes
> need to look that way is because of that line, which
> is extraneous.
> 
> By the way you should never piddle with your
> superglobals like that.

* * * * * * * * * *

This all started when I was trying out ZendStudio. I
got some sort of error message that suggested I use
"constant" includes. I didn't know what it meant, so I
ask on some online forums, and people suggested I use
that particular include link, though several
variations of it were recommended.

Then they told me I had to set up virtual hosts to
make it work. Speaking of which, something just flaked
out. I wanted to return to my first virtual host
setting - which worked beautifully, except for those
PHP includes.

But I'm now getting all sorts of weird feedback.
Typing in http://rep5/ leads to a blank screen, or I
see the home page of sites/geobop whether I type in
http://geobop, http://rep5 or http://geozoo Sometimes,
if I click on one of my links to a site - say geozoo,
it seems to "adopt" that site, so that if I later
click on the link to geoworld, I get
http://geozoo/geoworld

I'm thoroughly confused.

Again, here are the relevant paths:

C:/xampp/apache/
C:/xampp/htdocs/
C:/sites/[my websites]

Here's what I have in my HOSTS file:

#      102.54.94.97     rhino.acme.com          #
source server
#       38.25.63.10     x.acme.com              # x
client host

127.0.0.1 localhost
127.0.0.1 geobop
127.0.0.1 geowebworks
127.0.0.1 geoworld
127.0.0.1 geozoo
127.0.0.1 geosymbols
127.0.0.1 politix
127.0.0.1 geoworldNA
127.0.0.1 geoworldSA
127.0.0.1 geoworldEurasia
127.0.0.1 geoworldMideast
127.0.0.1 geoworldAfrica
127.0.0.1 geoworldAus
127.0.0.1 geoworldAnt
127.0.0.1 geoworldOceanus
127.0.0.1 geozoo
127.0.0.1 geozooBirds
127.0.0.1 geozooMammals
127.0.0.1 geobopcom
127.0.0.1 rep5
127.0.0.1 jail4bush
127.0.0.1 freedomware
127.0.0.1 edrevolt
127.0.0.1 seaschools
127.0.0.1 seattleschooldistrict
127.0.0.1 glasspalace
127.0.0.1 johnstanford
127.0.0.1 govwa
127.0.0.1 vmak
127.0.0.1 bergeson

And here's what I have in my conf file:

#<VirtualHost *>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log
common
#</VirtualHost>

<VirtualHost 127.0.0.1>
ServerAdmin admin@localhost
DocumentRoot "c:/sites"
ServerName localhost
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common
</VirtualHost>

<VirtualHost 127.0.0.1>
ServerAdmin webmaster@geobop
DocumentRoot "c:/sites/geobop"
ServerName geobop
ServerAlias *.geobop
ErrorLog logs/geobop-error.log
ScriptAlias /cgi-bin/ "c:/sites/geobop/cgi-bin/"
<Directory "c:/sites/geobop">
Options All Includes Indexes
</Directory>
</VirtualHost>

[Followed by all my other websites.]

I also tried it without the first block of code...

<VirtualHost 127.0.0.1>
ServerAdmin admin@localhost
DocumentRoot "c:/sites"
ServerName localhost
ErrorLog logs/localhost_error.log
CustomLog logs/localhost_access.log common
</VirtualHost>

but that didn't work, either. I can't figure out what
I did wrong.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts - What am I doing wrong?

Posted by Tim Burden <Ti...@Burden.ca>.
No, I'm saying your vhosts are probably OK, but the reason your includes
need to look that way is because of that line, which is extraneous.

By the way you should never piddle with your superglobals like that.

----- Original Message ----- 
From: "David Blomstrom" <da...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Tuesday, June 08, 2004 7:29 PM
Subject: Re: [users@httpd] Virtual Hosts - What am I doing wrong?


> --- Tim Burden <Ti...@Burden.ca> wrote:
> > What  is the purpose of this line?
> > $_SERVER['DOCUMENT_ROOT'] .= '/freedomware';
> >
> > I'm pretty sure you just set your global to
> > c:/sites/freedomware/freedomware
> > and so it's no wonder you have to back up the tree a
> > notch.
>
> Are you saying my virtual hosts are OK, but there's a
> problem with my include link? I had a hard time
> figuring that one out; I was given several different
> variations from different people, some of which worked
> and others that didn't.
>
> Thanks.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts - What am I doing wrong?

Posted by David Blomstrom <da...@yahoo.com>.
--- Tim Burden <Ti...@Burden.ca> wrote:
> What  is the purpose of this line?
> $_SERVER['DOCUMENT_ROOT'] .= '/freedomware';
> 
> I'm pretty sure you just set your global to
> c:/sites/freedomware/freedomware
> and so it's no wonder you have to back up the tree a
> notch.

Are you saying my virtual hosts are OK, but there's a
problem with my include link? I had a hard time
figuring that one out; I was given several different
variations from different people, some of which worked
and others that didn't.

Thanks.


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual Hosts - What am I doing wrong?

Posted by Tim Burden <Ti...@Burden.ca>.
What  is the purpose of this line?
$_SERVER['DOCUMENT_ROOT'] .= '/freedomware';

I'm pretty sure you just set your global to c:/sites/freedomware/freedomware
and so it's no wonder you have to back up the tree a notch.

----- Original Message ----- 
From: "David Blomstrom" <da...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Tuesday, June 08, 2004 7:06 PM
Subject: [users@httpd] Virtual Hosts - What am I doing wrong?


> I thought I had successfully set up virtual hosts, but
> it can't be right, because the php include links below
> won't work without the extra path segment (../):
>
> <?php
> $_SERVER['DOCUMENT_ROOT'] .= '/freedomware';
> include
> ($_SERVER['DOCUMENT_ROOT']."/../includes/head.php");
> ?>
> </head>
> <body>
> <?php include
> ($_SERVER['DOCUMENT_ROOT']."/../includes/top.php"); ?>
>
> The last line SHOULD read <?php include
> ($_SERVER['DOCUMENT_ROOT']."/includes/top.php"); ?>,
> right?
>
> But I can't figure out what I did wrong. Let's start
> with my set up. Below are all the relevant paths\
>
> C:/xampp/apache/
> C:/xampp/htdocs/
> C:/sites/mysites
>
> Below are the first few entries on my httpd conf file:
>
> <VirtualHost 127.0.0.1>
> ServerAdmin admin@localhost
> DocumentRoot "c:/sites"
> ServerName localhost
> ErrorLog logs/localhost_error.log
> CustomLog logs/localhost_access.log common
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> ServerAdmin webmaster@1
> DocumentRoot "c:/sites/1"
> ServerName 1
> ServerAlias *.1
> ErrorLog logs/1-error.log
> ScriptAlias /cgi-bin/ "c:/sites/1/cgi-bin/"
> <Directory "c:/sites/1">
> Options All Includes Indexes
> </Directory>
> </VirtualHost>
>
> <VirtualHost 127.0.0.1>
> ServerAdmin webmaster@geobop
> DocumentRoot "c:/sites/geobop"
> ServerName geobop
> ServerAlias *.geobop
> ErrorLog logs/geobop-error.log
> ScriptAlias /cgi-bin/ "c:/sites/geobop/cgi-bin/"
> <Directory "c:/sites/geobop">
> Options All Includes Indexes
> </Directory>
> </VirtualHost>
>
> For some reason, c:/sites/1 doesn't work, but all my
> other sites work. For example, I can preview
> c:/sites/geobop at http://geobop/ But the include
> links require that extra ../
>
> It occurred to me that the first block of code might
> not belong, so I deleted it...
>
> <VirtualHost 127.0.0.1>
> ServerAdmin admin@localhost
> DocumentRoot "c:/sites"
> ServerName localhost
> ErrorLog logs/localhost_error.log
> CustomLog logs/localhost_access.log common
> </VirtualHost>
>
> Now, if I type in http://geobop/, http://freedomware/
> or any other site, I get a different page; it appears
> to be the index page in the folder sites.
>
> So what am I doing wrong? I don't mind include links
> with an extra ../. They appear to work both locally
> and online. I'm just concerned that I'll eventually
> run into trouble if they're incorrect.
>
> Thanks.
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org