Problems with Virtual Hosts

Problems with Virtual Hosts

Post by Wiliam Stephen » Thu, 17 Sep 1998 04:00:00



Hi Folks,

I'm having problems with Virtual Hosts. I assigned a virtual host with
www.domain2.com (it shares the same IP as the main server). But ever
since I've done this, every request to the main server (domain1.com)
will place the user in the virtual host's (domain2.com) web directory.
Why is this? If I try to access domain2.com with my browser -- I get to
the correct directory. If I try to access the main server (domain1.com)
however, I get to the document root of domain2.com. Hmm. Any
workarounds?

Oh yeah, just for the record, I got this [warn] in my main apache log
file:

[Sun Jun 28 17:02:59 1998] [warn] NameVirtualHost 206.69.43.160:80 has
no VirtualHosts

When it does have a virtual host right underneath it. Hmm.

Regards,
_______________________________________________________________

 Wiliam Stephens                  Web Developer & Programmer

_______________________________________________________________

 
 
 

Problems with Virtual Hosts

Post by Marc Slemk » Thu, 17 Sep 1998 04:00:00


Did you try reading the docs?

Obviously not.

In particular, pay attention to the fact that if an IP is set for a
NameVirtualHost then the main server is not used for that IP.

Of course, you don't even mention the detail of what webserver or version
you are running, but I'm guessing it is Apache 1.3.x.


>Hi Folks,
>I'm having problems with Virtual Hosts. I assigned a virtual host with
>www.domain2.com (it shares the same IP as the main server). But ever
>since I've done this, every request to the main server (domain1.com)
>will place the user in the virtual host's (domain2.com) web directory.
>Why is this? If I try to access domain2.com with my browser -- I get to
>the correct directory. If I try to access the main server (domain1.com)
>however, I get to the document root of domain2.com. Hmm. Any
>workarounds?
>Oh yeah, just for the record, I got this [warn] in my main apache log
>file:
>[Sun Jun 28 17:02:59 1998] [warn] NameVirtualHost 206.69.43.160:80 has
>no VirtualHosts
>When it does have a virtual host right underneath it. Hmm.
>Regards,
>_______________________________________________________________
> Wiliam Stephens                  Web Developer & Programmer

>_______________________________________________________________


 
 
 

Problems with Virtual Hosts

Post by Wiliam Stephen » Thu, 17 Sep 1998 04:00:00


Hi Marc,

I'm using Apache 1.3.1 on a Linux Platform. I've read all the Virtual
Host Documentation on the Apache Web Site, and I'm still stumped. What I
need is an example SRM.CONF or HTTPD.CONF file from someone with Virtual
Host Directives set for non-IP based domains. If that's possible?

Quote:> In particular, pay attention to the fact that if an IP is set for a
> NameVirtualHost then the main server is not used for that IP.

Yikes! I didn't know this. That means then, that I have to have two IPs.
One for the main server and another for the Virtual Hosts that the
server will serve? How about making all domains virtual hosts and not
have a main, dedictaed server? Will this work off one domain?

Thanks!
_______________________________________________________________

 Wiliam Stephens                  Web Developer & Programmer

_______________________________________________________________

 
 
 

Problems with Virtual Hosts

Post by Marc Slemk » Thu, 17 Sep 1998 04:00:00



Quote:>Hi Marc,
>I'm using Apache 1.3.1 on a Linux Platform. I've read all the Virtual
>Host Documentation on the Apache Web Site, and I'm still stumped. What I
>need is an example SRM.CONF or HTTPD.CONF file from someone with Virtual
>Host Directives set for non-IP based domains. If that's possible?

There are examples configs in the docs.

Quote:>> In particular, pay attention to the fact that if an IP is set for a
>> NameVirtualHost then the main server is not used for that IP.
>Yikes! I didn't know this. That means then, that I have to have two IPs.
>One for the main server and another for the Virtual Hosts that the
>server will serve? How about making all domains virtual hosts and not
>have a main, dedictaed server? Will this work off one domain?

Exactly.  If you only have one IP, then the concept of a main server
doesn't work very well for various reasons.  That means you should
just pretend the main server doesn't exist, and make it a virtualhost.
 
 
 

Problems with Virtual Hosts

Post by Alan J. Flavel » Fri, 18 Sep 1998 04:00:00



> > In particular, pay attention to the fact that if an IP is set for a
> > NameVirtualHost then the main server is not used for that IP.

> Yikes! I didn't know this.

Then you either hadn't read the documentation or hadn't grasped it.
http://www.apache.org/docs/vhosts/name-based.html

 Note: When you specify an IP address in a NameVirtualHost directive
 then requests to that IP address will only ever be served by matching
 <VirtualHost>s. The "main server"  will never be served from the
 specified IP address.

Quote:> That means then, that I have to have two IPs.

Don't jump to that conclusion.  It depends on what you want to achieve.

Quote:> One for the main server and another for the Virtual Hosts that the
> server will serve?

Nope.  Just define the first <virtualhost n.n.n.n> to be the one that
you want to act as your "main" server, and then define the fully
qualified host names associated virtual host entries in the second,
third, etc. <virtualhost n.n.n.n> brackets.

Quote:> How about making all domains virtual hosts and not
> have a main, dedictaed server?

If I understand what you're getting at, then "yes".

Quote:> Will this work off one domain?

Sorry, I don't understand the question.

Name-based virtual hosts have to have different host names, at least,
and they have to be DNS-registered.  Whether they are in the same or
different DNS domains isn't relevant.  Or what was your question really?

 
 
 

Problems with Virtual Hosts

Post by John Marvin Wall » Fri, 18 Sep 1998 04:00:00


: I'm using Apache 1.3.1 on a Linux Platform. I've read all the Virtual
: Host Documentation on the Apache Web Site, and I'm still stumped. What I
: need is an example SRM.CONF or HTTPD.CONF file from someone with Virtual
: Host Directives set for non-IP based domains. If that's possible?

These examples spell it out pretty clearly:
http://www.apache.org/docs/vhosts/examples.html

john

--

John M. Walley                          Magpies
Webmaster                               You Deserve The Bird

 
 
 

Problems with Virtual Hosts

Post by Wiliam Stephen » Fri, 18 Sep 1998 04:00:00


Thanks to everyone who helped! I managed it by making the "main server"
into a Virtual Host along with all the other virtual hosts.

Thanks!



> : I'm using Apache 1.3.1 on a Linux Platform. I've read all the Virtual
> : Host Documentation on the Apache Web Site, and I'm still stumped. What I
> : need is an example SRM.CONF or HTTPD.CONF file from someone with Virtual
> : Host Directives set for non-IP based domains. If that's possible?

> These examples spell it out pretty clearly:
> http://www.apache.org/docs/vhosts/examples.html

> john

> --

> John M. Walley                          Magpies
> Webmaster                               You Deserve The Bird


--
_______________________________________________________________

 Wiliam Stephens                  Web Developer & Programmer

_______________________________________________________________

 
 
 

Problems with Virtual Hosts

Post by Wiliam Stephen » Fri, 18 Sep 1998 04:00:00


Hi Folks,

I've now created new Virtual Hosts, each one with their unique IP
address. All is well, IMO. I've set BindAddress to * and all. Anyway,
the problem is now, that none of the Virtual Hosts get served. The
server can't find the server, and requests gets timed out. This is what
the error log said:

[Mon Jun 29 14:35:26 1998] [notice] httpd: caught SIGTERM, shutting down

Any ieads on this error? Any ideas what I'm doing wrong?

Thanks for your help.

Regards,
_______________________________________________________________

 Wiliam Stephens                  Web Developer & Programmer

_______________________________________________________________

 
 
 

Problems with Virtual Hosts

Post by John Heye » Fri, 25 Sep 1998 04:00:00



Quote:> >Yikes! I didn't know this. That means then, that I have to have two IPs.
> >One for the main server and another for the Virtual Hosts that the
> >server will serve? How about making all domains virtual hosts and not
> >have a main, dedictaed server? Will this work off one domain?

> Exactly.  If you only have one IP, then the concept of a main server
> doesn't work very well for various reasons.  That means you should
> just pretend the main server doesn't exist, and make it a virtualhost.

        Thanks for the help.  I'm limited to just one IP address and
several hostname VirtualHosts, and it took me days of fooling around to
get the main server to go to the right directory.  Frankly, I'm a little
pissed off because I read the vhosts docs in the Apache web site and while
it goes into a lot of detail about NameVirtual hosts and multiple IP
Addresses, it doesn't mention the fact that when you are using only
hostname-based Virtual hosts, things like DocumentRoot are useless - in
fact it implies quite the opposite.  

--
John Heyer :: University of Wisconsin - Madison :: http://heyer.ml.org

 
 
 

Problems with Virtual Hosts

Post by Christopher Schul » Mon, 28 Sep 1998 04:00:00


On Thu, 17 Sep 1998 16:17:35 +0100, in


Quote:>Hi Folks,

>I've now created new Virtual Hosts, each one with their unique IP
>address. All is well, IMO. I've set BindAddress to * and all. Anyway,
>the problem is now, that none of the Virtual Hosts get served. The
>server can't find the server, and requests gets timed out. This is what
>the error log said:

The server can't find the server?  What does this mean?  Are you
trying to go in with a url like http://www.domain.com/ or
http://123.456.789.123/?  If you get no response from the server, make
sure that dns is correctly configured to point to the corresponding ip
address, and also make sure that the machine in question is configured
to respond to the ip that dns points to, as well as the web server is
configured to serve requests for.

Try pinging the ip address, to see if your machine is answering.  If
not, you have other issues to work.

Quote:>[Mon Jun 29 14:35:26 1998] [notice] httpd: caught SIGTERM, shutting down

>Any ieads on this error? Any ideas what I'm doing wrong?

That's all you see????  That line means apache was killed off, aka
killall httpd
or
kill -9 `cat /www/logs/httpd.pid` or whatever

You should see another line, like:

[Sun Sep 27 01:01:59 1998] [notice] Apache/1.3.1 (Unix) configured --
resuming normal operations

to tell you the server is running again..... The time stamp is Jun 29,
which would lead me to believe that the actual log file are perhaps
stored in another place.  That or your clock is off.

To see if apache is running, do a ps, and grep for httpd.  Something
like:

ps -aux | grep -i httpd or
ps -aef | grep -i httpd

depending on your OS type.

If you don't see any apache daemons running, then that's also a
problem.

In short, I'd say you may have multiple issues that need to be dealt
with.

>Thanks for your help.

>Regards,
>_______________________________________________________________

> Wiliam Stephens                  Web Developer & Programmer

>_______________________________________________________________

--
My email address has been  rot-13 encrypted because of spammers.
Apply a rot-13 filter to this string to get my real email address:

If you need a program to decode it, download: (pc)
ftp://garbo.uwasa.fi/pub/pc/fileutil/rot13.zip
 
 
 

1. Problems whith virtual host

Hi, my apache server is 1.3.1
        I try to use Name-based Virtual Hosts , we have a server
server.domain1.com which has 2 alias (CNAME) www.domain1.com and
www.domain2.com.
        I read the doc "Virtual Host examples for common setups " and try to
apply to my situation one IP address and 2 names.
------------------------
http.conf:
-----------
ServerName server.domain1.com

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>
DocumentRoot /apache/www
ServerName www.domain1.com
</VirtualHost>

<VirtualHost 1.2.3.4>
DocumentRoot /apache/www/domain2
ServerName www.domain2.com
</VirtualHost>
-------------------------
I put nothing about virtual host in the srm.conf.

When i start apache, i have:
--------------
./apachectl start
VirtualHost configuration:
1.2.3.4:80      is a NameVirtualHost
                       default server www.domain1.com
 (/usr/local/apache_1.3.1/etc/httpd.conf:245)
                       port 80 namevhost www.domain1.com
(/usr/local/apache_1.3.1/etc/httpd.conf:245)
                       port 80 namevhost www.domain2.com
(/usr/local/apache_1.3.1/etc/httpd.conf:250)
./apachectl start: httpd started
------------------
So the namevirtualhost seems to work, everything is fine with the
domain1 but the domain2 has problems with the first page.

When i try with netscape 4 the url www.domain2.fr, i got the index.html
of the domain1 but not the images, because the images are search in the
documentroot of domain2.

When i try www.domain2.fr/index.html. everything is fine.

When i try with a client running on server.domain1.com everything is
fine.

????? any idea...

2. Trouble with xxgdb

3. Problems with virtual hosts

4. core any half hour ??????!!!!!!!!!

5. Problems with virtual host

6. Lexmark DeskJet 1020 color printer

7. problem accessing virtual host from windows xp

8. Simple Messaging Protocol

9. problems with virtual hosts

10. apache problems with virtual hosts

11. Apache index problem with virtual host

12. Problem with virtual-hosting under linux

13. Problem with virtual host on apache and Digital Unix