Web Servers on Unix and Linux - Virtual Hosts do not work at all in Apache 2.0.40 (linux) Help!

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > May 2004 > Virtual Hosts do not work at all in Apache 2.0.40 (linux) Help!





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Virtual Hosts do not work at all in Apache 2.0.40 (linux) Help!
Ohmster

2004-05-31, 4:54 pm

I run a redhat 9 sever on my adsl computer and have run it for years.
Computer is connected via ethernet cable to adsl modem, roaring penguin
script makes and maintains the internet connection with PPPoE. The modem is
setup as bridged to make it transparent to the system and allow the redhat
machine to connect and get the IP address.

I have installed and am running Server version: Apache/2.0.40, Server built:
Apr 21 2004 11:49:03. This comes as an rpm file for redhat. I have used this
server for several years to run the root server and have enabled userdirs. I
also use .htaccess files and allow cgi. Everything works so well, php works,
mysql works with it and I use these features for a private (.htaccess files
limit logins to family only.) famliy website in my userdir and I also allow 1
friend to run his stationary website from his userdir. I have a single static
IP address for this machine.

I have a FQND and get full DNS with an A record from no-ip.com and get with
this domain, www, ftp, mail, and an MX record. My machine answers to it's
FQDN. I went to zoneedit.com and got DNS for my family.org name with an A
record for the domain and the www.domain. Both regular domain and family
domains are on two separate DNS hosts and both point to the same IP address,

My family has a bit of trouble with this scheme because the domain is not
family related and one has to access the userdir with tilde to get to the
site so I recently purchased a family domain "family.org" for them to make it
easy. I went to the very bottom of my /etc/httpd/conf/httpd.conf file and
added the virtual containers for a dummy site, my family site, and my regular
domain site.

I am having MAJOR problems with this, I spent the entire day yesterday in
trying to make this work. No matter what I do, all http request are caught in
the first virtual container and will go no further, no matter what I do. I
tried to do this with the real sites and got stuck so after asking questions
in the alt.os.linux, comp.os.linux.networking, and alt.apache.configuration
groups, I decided to do some very basic and rudimentry tests. After failing
with my current httpd.conf file (I made severl changes in it to allow
userdirs, and full access for all .htaccess files, and allowed cgi both in
and out of cgi-bin directories.), I took a brand new httpd.conf.rpmnew file
and only changed it at the very bottom to add the test virual containers.

This is my test and these are my results (I was working with a fellow named
Ken and used his testing procedure, henceforth the name ken in the configs
and in the dialog.):

Here is what I used for the virtual containers (Very bottom
of my /etc/httpd/conf/httpd.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 *>
ServerName www.metrap.net
DocumentRoot /var/www/trap
CustomLog /var/log/testlog/access.log kenlogtrap
ErrorLog /var/log/testlog/errort.log
</VirtualHost>

<VirtualHost *>
ServerName www.myfamily.org
CustomLog /var/log/testlog/access.log kenfam
ErrorLog logs/errorb.log
</VirtualHost>

<VirtualHost *>
ServerName www.mydomain.com
CustomLog /var/log/testlog/access.log kenlogme
ErrorLog /var/log/testlog/erroro.log
</VirtualHost>

RESULTS: *******************

I saved the changes and restarted httpd.
I used my IE browser on my XP machine on my LAN to access these websites:

http://www.mydomain.com
http://www.myfamly.org
http://<My IP Address>

Every single one landed me in the trap site. The access.log showed the word
"kenlogtrap" 54 times and nothing else. The error log stayed 0 bytes. The
erroro.log file stayed 0 bytes. In a very short time, my error log filled up
with http request for my friend's stationary site and all "File does not
exsist" errors as I would expect, since I have userdirs setup and my friend
has his stationary site here.

ALL HTTP REQUESTS GET CAUGHT IN THE FIRST VIRTUAL HOST AND WILL GO NO
FURTHER!

END RESULTS: *******************

This is the problem. I cannot get past the very first virtual host no matter
how it is done. I purposly used very simple tests for this because I spent
the entire day yesterday doing this with the real sites and got nowhere.

Is it possible that something else, higher up on the conf page is causing
this? I did change a few things to relax the server a bit to allow .htaccess
files and cgi scripts to run, both in and out of cgi-bin directories.

I am not nuts, Ken, this all sounds so very simple and yet it does not work
at all, not ever, not even one time for me. I can tell from your config and
testing on your hosts that yours is working. Even though all the sites are
identical, the trap does work to your IP address and anything else gets
through.

Either I did something wrong in the httpd.conf file long ago that did not
show up until now when I tried to use virtual hosts or my server is just
plain broken somehow. Here is the version of apache that I am using:

[root@ohmster conf]# httpd -v
Server version: Apache/2.0.40
Server built: Apr 21 2004 11:49:03
[root@ohmster conf]#

What could be the problem? How can I get someone to look at this httpd.conf
file and see what is wrong with it? I know, I have a httpd.conf.rpmnew file
that is virgin. Perhaps I should load that one and put the virtual hosts in
it that I have just tried and see what happens...

Same thing. You know, something funny is going on around here. I have a
favicon.ico for my family site but not for the trap site, yet I get the
favicon icon with www.myfamily.org. Maybe Windows is doing something funny.
Maybe I should try this on the linux machine with good old lynx. I had
problems with getting my DNS to update on my windows machine unless I reboot.
Let's try it and see...

Nope, all to the trap page. Lynx did do a lookup for myfamily.org so that
took a little while but I ended up right at the trap page. So it cannot be
that I screwed up the httpd.conf file. I used a virgin one supplied with the
rpm for httpd-2.0.40-21.11. Ack, so maybe it is not apache? What is it then?

I have mydomain.com at no-ip.com as a DNS host (A) with www, mydomain, ftp,
and an MX record for the mail, and it points right to my IP address. I have
myfamily.org and www.myfamily.org at zoneedit.com with (A) records to each.

I give up but I really need this to work, what would you do next, Ken,
anyone?

What the heck is wrong with this server and why will it not do virutal hosts?

--
My email address is invalid, thanks to
all of these rotten spambots.
Email me by assembling this address:
tinykitty "ay tea" ohmster "dee oh tea" com
~Ohmster
Ohmster

2004-05-31, 4:54 pm

Ohmster <donteven@thinkaboutit.com> wrote in
news:Xns94FA7C21E690Amybigone@129.250.170.82:

> <VirtualHost *>
> ServerName www.metrap.net
> DocumentRoot /var/www/trap
> CustomLog /var/log/testlog/access.log kenlogtrap
> ErrorLog /var/log/testlog/errort.log
> </VirtualHost>
>
> <VirtualHost *>
> ServerName www.myfamily.org
> CustomLog /var/log/testlog/access.log kenfam
> ErrorLog logs/errorb.log
> </VirtualHost>
>
> <VirtualHost *>
> ServerName www.mydomain.com
> CustomLog /var/log/testlog/access.log kenlogme
> ErrorLog /var/log/testlog/erroro.log
> </VirtualHost>


I have been alerted to the fact that I am missing document roots and have
changed the test config as such:

<VirtualHost *>
ServerName www.ohmstrap.net
ServerAlias ohmtrap.net
DocumentRoot /var/www/trap
CustomLog /var/log/testlog/access.log kenlogtrap
ErrorLog /var/log/testlog/errort.log
</VirtualHost>

<VirtualHost *>
ServerName www.myfamily.org
ServerAlias myfamily.org
DocumentRoot /var/www/myfamily
CustomLog /var/log/testlog/access.log kenlogbaio
ErrorLog logs/errorb.log
</VirtualHost>

<VirtualHost *>
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/me
CustomLog /var/log/testlog/access.log kenlogme
ErrorLog /var/log/testlog/erroro.log
</VirtualHost>

I have turned off the firestarter firewall in case it is mangling the http
headers and maybe is not passing the domain info. No luck, all tests the same
and are going to the first virtual host trap.

Is there a test that I can run to see if the http headers contain the domain
info when requesting a document to rule this out like ethereal or something?
Can somebody please help with this? My Memorial Day weekend is being totally
ruined by this so freaking difficult task.

--
My email address is invalid, thanks to
all of these rotten spambots.
Email me by assembling this address:
tinykitty "ay tea" ohmster "dee oh tea" com
~Ohmster
David Efflandt

2004-05-31, 4:54 pm

On 31 May 2004 17:15:46 GMT, Ohmster <donteven@thinkaboutit.com> wrote:
> Ohmster <donteven@thinkaboutit.com> wrote in
> news:Xns94FA7C21E690Amybigone@129.250.170.82:


Do you have a wildcard: NameVirtualHost * (needed for name based vhosts
with unknown or dynamic IP)?

What is main ServerName (or server's hostname if not set)? I specifically
set a bogus ServerName and NO ServerName/ServerAlias in my default (first)
worm host, so it catches anything not matching name vhosts (or loopback
IP vhost).

What is UseCanonicalName setting (see docs for it), which should probably
be set to off?

What is main server DocumentRoot (outside of any vhosts)? If it is
/var/www/htdocs, have you defined <Directory> sections (what is allowed
Options, Allow, AllowOverride, etc.) for vhost DocumentRoot paths?

> I have been alerted to the fact that I am missing document roots and have
> changed the test config as such:
>
><VirtualHost *>
> ServerName www.ohmstrap.net
> ServerAlias ohmtrap.net
> DocumentRoot /var/www/trap
> CustomLog /var/log/testlog/access.log kenlogtrap
> ErrorLog /var/log/testlog/errort.log
></VirtualHost>
>
><VirtualHost *>
> ServerName www.myfamily.org
> ServerAlias myfamily.org
> DocumentRoot /var/www/myfamily
> CustomLog /var/log/testlog/access.log kenlogbaio
> ErrorLog logs/errorb.log
></VirtualHost>
>
><VirtualHost *>
> ServerName www.mydomain.com
> ServerAlias mydomain.com
> DocumentRoot /var/www/me
> CustomLog /var/log/testlog/access.log kenlogme
> ErrorLog /var/log/testlog/erroro.log
></VirtualHost>
>
> I have turned off the firestarter firewall in case it is mangling the http
> headers and maybe is not passing the domain info. No luck, all tests the same
> and are going to the first virtual host trap.
>
> Is there a test that I can run to see if the http headers contain the domain
> info when requesting a document to rule this out like ethereal or something?
> Can somebody please help with this? My Memorial Day weekend is being totally
> ruined by this so freaking difficult task.
>
> --
> My email address is invalid, thanks to
> all of these rotten spambots.
> Email me by assembling this address:
> tinykitty "ay tea" ohmster "dee oh tea" com
> ~Ohmster


--
David Efflandt - All spam ignored http://www.de-srv.com/
Ohmster

2004-05-31, 11:54 pm

efflandt@xnet.com (David Efflandt) wrote in
news:slrncbn074.rml.efflandt@typhoon.xnet.com:

> On 31 May 2004 17:15:46 GMT, Ohmster <donteven@thinkaboutit.com> wrote:
>
> Do you have a wildcard: NameVirtualHost * (needed for name based vhosts
> with unknown or dynamic IP)?


Yes. I have reverted to a very simple virtual container list just for
testing.

<VirtualHost *>
ServerName www.ohmstrap.net
ServerAlias ohmtrap.net
DocumentRoot /var/www/trap
CustomLog /var/log/testlog/access.log kenlogtrap
ErrorLog /var/log/testlog/errort.log
</VirtualHost>

<VirtualHost *>
ServerName www.baiofamily.org
ServerAlias baiofamily.org
DocumentRoot /var/www/baiofamily
CustomLog /var/log/testlog/access.log kenlogbaio
ErrorLog logs/errorb.log
</VirtualHost>

<VirtualHost *>
ServerName www.ohmster.com
ServerAlias ohmster.com
DocumentRoot /var/www/ohmster
CustomLog /var/log/testlog/access.log kenlogohm
ErrorLog /var/log/testlog/erroro.log
</VirtualHost>

>
> What is main ServerName (or server's hostname if not set)? I
> specifically set a bogus ServerName and NO ServerName/ServerAlias in my
> default (first) worm host, so it catches anything not matching name
> vhosts (or loopback IP vhost).


[ohmster@ohmster ohmster]$ hostname -a
ohmster
[ohmster@ohmster ohmster]$

> What is UseCanonicalName setting (see docs for it), which should
> probably be set to off?


UseCanonicalName On

>
> What is main server DocumentRoot (outside of any vhosts)? If it is
> /var/www/htdocs, have you defined <Directory> sections (what is allowed
> Options, Allow, AllowOverride, etc.) for vhost DocumentRoot paths?


DocumentRoot "/var/www/html"

Yes.

I don't think that apache is getting the http header that supplies the host
name being requested. I have been running ethereal off and on today and have
not found much host info in the http packets, other than GET requests for css
sheets, or jpg or gif images. Not sure what else to do. I have not "munged"
these containers because I really need help and this is the actual config for
testing. The domains are vailid.



--
My email address is invalid, thanks to
all of these rotten spambots.
Email me by assembling this address:
tinykitty "ay tea" ohmster "dee oh tea" com
~Ohmster
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com