You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jean-François <gr...@gmail.com> on 2009/08/10 03:48:56 UTC

[users@httpd] vhost not receiving the connections

Hello,

I’m having an issue with serving the correct pages on my httpd with vhosts.

Basically (more config details follow, below), I’m running a server on
port 80 and wanted to add a vhost (named-based config) so that a
specific task is server by another server. Well, a vhost.

I don’t know why it’s like this, but right now it seems that whenever
I try to connect on the vhost, pages are served from the DocumentRoot
of the main server. Another thing: this is behind a firewall that
block port 80. The firewall redirects port 801 to port on the
concerned boxen.

Here’s a bit of config :

My main server is at w.dnsalias.net . My vhost is at x.dnsalias.net .
There is no name resolution issue, both hosts (x and y) resolve to the
same IP; I'm running apache v2.2.11 on a Solaris 10u5-x86 box.

The whole httpd (config, logs, docroot, etc) resides in
/tools/apache2/ . The way I want it set up is that my main server’s
DocumentRoot should use the default value which in this case should be
/tools/apache2/htdocs/ , and the vhosts should use
/tools/apache2/samples/ . As I mentioned above, seems like that
instead of going at /tools/apache2/samples/index.html when I navigate
to http://x.dnsalias.net:801/ (firewall redirects to port 80), it goes
in /tools/apache2/htdocs/index.html (the famous “it works!” page).

My main httpd.conf reads like this (of course I’ve left off parts not
pertinent to this issue):

ServerRoot “/tools/apache2”
Listen 80
ServerAdmin myEmailAddress@somewhere
ServerName w.dnsalias.net
DocumentRoot “/tools/apache2/htdocs”

Then, the very last line of the httpd.conf is :
Include conf/vhosts_jfg.conf

The file /tools/apache2/conf/vhosts_jfg.conf is this one (very short) :

NameVirtualHost w.dnsalias.net
NameVirtualHost x.dnsalias.net

<VirtualHost w.oslo.dnsalias.net:*>
    ServerAdmin me@somewhere.ca
   DocumentRoot "/tools/apache2/htdocs/"
    ServerName w.dnsalias.net
</VirtualHost>

<VirtualHost x.dnsalias.net:*>
    ServerAdmin me@somewhere.ca
   DocumentRoot "/tools/apache2/samples/"
    ServerName x.dnsalias.net
    ErrorLog "logs/x-error_log"
    CustomLog "logs/x-access_log" common
</VirtualHost>


I also noticed that logs/x-error_log and logs/x-acces_log are left
clean, no data is ever written there, which leads me to think that my
httpd seems to be ignoring my vhost altogether.

Do you people have an idea why my server is behaving like this ?

Thanks,

Jeff

---------------------------------------------------------------------
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] vhost not receiving the connections

Posted by Jean-François <gr...@gmail.com>.
Hi Kris. Both you and James Zuelow hit right on target. I've corrected
my conf files and all work fine now.

Thanks again, Sirs !

-- JFG

On Mon, Aug 10, 2009 at 1:22 AM, Krist van
Besien<kr...@gmail.com> wrote:
> On Mon, Aug 10, 2009 at 3:48 AM, Jean-François<gr...@gmail.com> wrote:
>> Hello,
>>
>> I’m having an issue with serving the correct pages on my httpd with vhosts.
>
> That is because you haven't properly configured it.
>
> You need the following directive:
>
> NameVirtualhost *.80
>
> You don't put ip's or hostnames in the NameVirtualHost statement,
> unless you really know very well what you are doing...
>
> Then you need to add your vitualhosts with exactly the same parameter
> in the VirtualHost block:
>
> <VirtualHost *:80>
>
> Servername w.dnsalias.net
>
> # rest of your directives for w.dnsalias.net
>
> </VirtualHost>
>
> <VirtualHost *:80>
>
> ServerName x.dnsalias.net
>
> # rest of your directives for x.dnsalias.net
>
> <VirtualHost>
>
> This is an error often made by people configuring virtualhosts for the
> first time (and not reading the documentation properly :-)
> The paramter to <VirtualHost> is not the hostname of your virtualhost,
> it is the ip/port combination you have configured name based virtual
> hosts on...
>
> Once you've got your hosts configured properly just test your config
> with "httpd -S". You should get a nice list of your hosts...
>
>
> 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
>
>

---------------------------------------------------------------------
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] vhost not receiving the connections

Posted by Krist van Besien <kr...@gmail.com>.
On Mon, Aug 10, 2009 at 3:48 AM, Jean-François<gr...@gmail.com> wrote:
> Hello,
>
> I’m having an issue with serving the correct pages on my httpd with vhosts.

That is because you haven't properly configured it.

You need the following directive:

NameVirtualhost *.80

You don't put ip's or hostnames in the NameVirtualHost statement,
unless you really know very well what you are doing...

Then you need to add your vitualhosts with exactly the same parameter
in the VirtualHost block:

<VirtualHost *:80>

Servername w.dnsalias.net

# rest of your directives for w.dnsalias.net

</VirtualHost>

<VirtualHost *:80>

ServerName x.dnsalias.net

# rest of your directives for x.dnsalias.net

<VirtualHost>

This is an error often made by people configuring virtualhosts for the
first time (and not reading the documentation properly :-)
The paramter to <VirtualHost> is not the hostname of your virtualhost,
it is the ip/port combination you have configured name based virtual
hosts on...

Once you've got your hosts configured properly just test your config
with "httpd -S". You should get a nice list of your hosts...


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