You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dan Yamins <dy...@gmail.com> on 2009/03/13 21:59:58 UTC

[users@httpd] PRoblem with virtual host setup

Hi, I'm trying to set up a virtual host on a new OS10.5.6 machine.   I'm
using settings that I run on several other OSX machines (also 10.5.6) and
they work fine, but for some reason fail on this machine .
The goal is set up the virtual host in the directory
/Users/dad/research/dataenv.   The virtual host name is "DataEnvironment".

With my current settings, when I run apachectl -t I get:

   [Fri Mar 13 16:48:48 2009] [warn] VirtualHost 127.0.0.1:80 overlaps with
VirtualHost 127.0.0.1:80, the first has precedence, perhaps you need a
NameVirtualHost directive
   [Fri Mar 13 16:48:48 2009] [warn] NameVirtualHost *:80 has no
VirtualHosts
   Syntax OK

When I run apachectl -S I get:

   [Fri Mar 13 16:56:45 2009] [warn] VirtualHost 127.0.0.1:80 overlaps with
VirtualHost 127.0.0.1:80, the first has precedence, perhaps you need a
NameVirtualHost directive
   [Fri Mar 13 16:56:45 2009] [warn] NameVirtualHost *:80 has no
VirtualHosts
   VirtualHost configuration:
   127.0.0.1:80           DataEnvironment
(/private/etc/apache2/users/dad.conf:1)
   Syntax OK


So it looks like apache things there's a virtual host in the right place.
However, when I go to http://DataEnvironment in any browser, I get, e.g:

Safari can’t find the server.

Safari can’t open the page “http://dataenvironment/” because it can’t find
the server “dataenvironment”.
If anyone could shed some light that would be great (and sorry if I'm making
an obvious stupid error).

best,
Dan


Below I've included the text of my /private/etc/hosts and httpd-vhosts.conf
configuration files.  I've also uncommented the virtual host include line in
httpd.conf.


/private/etc/hosts:


127.0.0.1: localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0 localhost
127.0.0.1: DataEnvironment



httpd-vhosts.conf:

<VirtualHost 127.0.0.1:80>
DocumentRoot "/Users/dad/research/dataenv/"
ServerName DataEnvironment

<Directory /Users/dad/research/dataenv>
Options FollowSymLinks All MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<Directory /Users/dad/research/dataenv/System/CGI-Executables>
Options FollowSymLinks All MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

Re: [users@httpd] PRoblem with virtual host setup

Posted by Justin Pasher <ju...@newmediagateway.com>.
Dan Yamins wrote:
> Hi, I'm trying to set up a virtual host on a new OS10.5.6 machine. 
>   I'm using settings that I run on several other OSX machines (also 
> 10.5.6) and they work fine, but for some reason fail on this machine . 
>
> The goal is set up the virtual host in the directory 
> /Users/dad/research/dataenv.   The virtual host name is 
> "DataEnvironment".   
>

[snip]

To me, the error message from Safari seems more like a "I can't resolve 
this hostname" error as opposed to a "this site won't load error". First 
try doing a "ping DataEnvironment" to see if it correctly resolves to 
"127.0.0.1". If not, it means your hosts file is either not being read 
or your DNS is screwy.

If the ping comes back successfully, then check your Apache access log 
and error log to make sure the request is being properly seen and if 
it's producing any errors. You can also add the following directive to 
your config file to avoid the warning on start-up.

NameVirtualHost 127.0.0.1:80

This will also ensure that Apache tries to server up your VirtualHost 
entry when the Host: header is "DataEnvironment" (as opposed to falling 
back to the default site).


-- 
Justin Pasher

---------------------------------------------------------------------
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] PRoblem with virtual host setup

Posted by Krist van Besien <kr...@gmail.com>.
On Fri, Mar 13, 2009 at 9:59 PM, Dan Yamins <dy...@gmail.com> wrote:
>
> When I run apachectl -S I get:
>    [Fri Mar 13 16:56:45 2009] [warn] VirtualHost 127.0.0.1:80 overlaps with
> VirtualHost 127.0.0.1:80, the first has precedence, perhaps you need a
> NameVirtualHost directive
>    [Fri Mar 13 16:56:45 2009] [warn] NameVirtualHost *:80 has no
> VirtualHosts
>    VirtualHost configuration:
>    127.0.0.1:80           DataEnvironment
> (/private/etc/apache2/users/dad.conf:1)


So the virtualhost config that will be used for this site is the one
in the file "/private/etc/apache2/users/dad.conf"
What is in that file?

Furthermore you  have a mismatch between your "VirtualHost" statement
and your <VirtualHost> blocks.

If your NameVirtualHost statement reads:
NameVirtualHost *:80

then your <VirtualHost> blocks must all be:
<VirtualHost *:80>

You have however: <VirtualHost 127.0.0.1:80> and that apperently
twice, and apache is a tad confused about what you want. That's what
all those error messages mean.

So you either need to change your NameVirtualHost statement, or your
<VirtualHost> blocks.

The second thing you need to to is to use all lowercase hostnames,
just like everyone else in the world does. That is probably causing
all kinds of problems.

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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] PRoblem with virtual host setup

Posted by Glen Barber <gl...@gmail.com>.
On Fri, Mar 13, 2009 at 4:59 PM, Dan Yamins <dy...@gmail.com> wrote:
>
> /private/etc/hosts:
>
> 127.0.0.1: localhost
> 255.255.255.255 broadcasthost
> ::1             localhost
> fe80::1%lo0 localhost
> 127.0.0.1: DataEnvironment
>

Try putting:
    127.0.0.1: localhost DataEnvironment
one one line if you can't resolve the address.


-- 
Glen Barber

---------------------------------------------------------------------
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