Re: tomcat virtual host

2008-11-21 Thread mtail
Hi André and every body,

Thank you very mutch for the details:))

Tail

- Mail Original -
De: André Warnier [EMAIL PROTECTED]
À: Tomcat Users List users@tomcat.apache.org
Envoyé: Jeudi 20 Novembre 2008 22:44:34 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: Re: tomcat virtual host

Caldarale, Charles R wrote:
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Subject: Re: tomcat virtual host

 status, or does something else happen?  Is the DNS name
 mysvn defined on the machine your browser is running on?

 Internet Explorer could not display this web  page
 i test this in local machine, so i do not use a DNS.
 

mtail,

The gurus here are flying high, and a bit intimidating sometimes.
So allow me to try, since for once I can maybe be useful here.

It is not enough to define a virtual host in Tomcat.  Your browser must 
also know where that virtual host is (on which machine). Even if this 
all happens on one single machine, the browser does not know who mysvn 
is, unless you give him a way to find out.
So let's start at the beginning.

1) When you type in your browser a URL like
http://mysvn:8080/something.html
the first thing the browser has to do, is to find an IP address that 
corresponds to the hostname mysvn.
That is because, on the Internet, machines find one another via IP 
addresses (like 123.23.34.102), and not by names (like mysvn). Names 
are only something for humans, easier to remember than numbers.

2) There are 2 places where the browser can find a translation of a host 
name into a host IP address, and it will try them in this order :

(a) : in the local hosts file.
Under Windows, it is usually c:/windows/system32/drivers/etc/hosts
and under Unix, it is usually /etc/hosts

(b) : using the DNS system.
That means, the browser knows the IP address of a DNS server, which is 
another computer which has access to a long list of translations between 
host names and host IP addresses, and it will ask that server.

So, the browser will first try (a).  If the browser is looking for the 
IP address of mysvn, and if there is a line in (a) like
1.2.3.4 mysvn
then the browser is happy : it now knows that the server IP address of 
mysvn is 1.2.3.4, and it can stop looking.

If the browser does not find a translation in (a), then it will ask (b) 
(the DNS system) for a translation.

If the DNS system also does not know, then it will send back I don't 
know, and your browser will say Cannot display that page, because it 
cannot even find the IP address of the server to which it should be talking.

3) When the browser has obtained a translation for mysvn into an IP 
address, then (and only then) it can go one step further :

It can now compose a HTTP request and send it to that IP address 
1.2.3.4.  This HTTP request will look like this :
GET /something.html HTTP/1.1
The browser will also add a second line to that request, like
Host: mysvn


4)
If all the above happened correctly, then the Tomcat listening at the IP 
address 1.2.3.4 will receive the request from the browser.

It is very important that you understand this :
Tomcat only receives the request if the browser has sent it to the 
correct IP address of the host where the Tomcat server runs.  That is 
true even if this all happens on one single machine.
If your browser could not get an IP address for mysvn, or if it got 
the wrong one, then Tomcat never even sees the request.

5) But let's suppose that everything above went fine, and that Tomcat 
receives the request.
Tomcat now looks at the second line of the request, the one that says :
Host: mysvn

That is when the Tomcat virtual hosts come into play (but not before).

Tomcat will now look if it has a Host named mysvn.
If it has one, it will use that Host configuration to answer the request.
(If Tomcat has no such Host, then it will use its default host to 
answer the request anyway.)

6) Now there can still be an error :

If the browser asked for the page /something.html, and Tomcat does not 
find that page in the document area of that virtual Host, then Tomcat 
will return an error not found to the browser, and the browser will 
also say Cannot display that page.
But the point is, this is another kind of error, and it happens later.

Your problem is probably due to the first reason : your browser cannot 
even find an IP address for the server mysvn.
It cannot find it, because it looks first in your local hosts file, and 
there is no line there with mysvn.  Then it asks the DNS system, and 
the DNS system also does not know the IP address of mysvn.

On the other hand, when your browser tries to find the address of 
localhost, then it *does* find it in the local hosts file, and that is 
why your URL
http://localhost:8080
works fine.

-- note --

The IP address 127.0.0.1 is special : it always means this machine.
So if you do ping 127.0.0.1 on any computer, that computer will always 
ping itself.
Or if you ask your browser
http://127.0.0.1
the browser will try

tomcat virtual host

2008-11-20 Thread mtail
Hi,

I deployed my webapp svn.war on webapps directory of tomcat 6.
I configured localy a virtual host with tomcat 6, but it does not work.
This url works :
http://localhost:8080/svn/

But when i use the virtual host, it does not works :
http://mysvn:8080/

This is a part of server.xml :

...
Host name=mysvn
appBase=webapps
unpackWARs=true autoDeploy=true
xmlValidation=false xmlNamespaceAware=false
  
   Valve className=org.apache.catalina.valves.AccessLogValve
directory=logs prefix=mysvn_log. 
suffix=.txt
pattern=combined resolveHosts=false/
/Host
...

Help please.
Thank's

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat virtual host

2008-11-20 Thread mtail

 I deployed my webapp svn.war on webapps directory of tomcat 6.
 I configured localy a virtual host with tomcat 6, but it does
 not work.
 This url works :
 http://localhost:8080/svn/

 But when i use the virtual host, it does not works :
 http://mysvn:8080/

 This is a part of server.xml :

 ...
 Host name=mysvn
 appBase=webapps
 unpackWARs=true autoDeploy=true
 xmlValidation=false
 xmlNamespaceAware=false

Valve
 className=org.apache.catalina.valves.AccessLogValve
 directory=logs
 prefix=mysvn_log. suffix=.txt
 pattern=combined
 resolveHosts=false/
 /Host
 ...

What Connectors do you have configured?  What does not work - *exactly* what 
are the symptoms?

When i tape http://mysvn:8080/ in browser to access to my web application, i 
have this :
Internet Explorer cannot display the web page
but when i tape http://localhost:8080/svnrepository; i access correctely to my 
application.
Find file attached server.xml

any idea ?

Thank's


?xml version='1.0' encoding='utf-8'?
!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the License); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--
!-- Note:  A Server is not itself a Container, so you may not
 define subcomponents such as Valves at this level.
 Documentation at /docs/config/server.html
 --
Server port=8005 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  !-- Global JNDI resources
   Documentation at /docs/jndi-resources-howto.html
  --
  GlobalNamingResources
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users
--
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources

  !-- A Service is a collection of one or more Connectors that share
   a single Container Note:  A Service is not itself a Container, 
   so you may not define subcomponents such as Valves at this level.
   Documentation at /docs/config/service.html
   --
  Service name=Catalina
  
!--The connectors can use a shared executor, you can define one or more named thread pools--
!--
Executor name=tomcatThreadPool namePrefix=catalina-exec- 
maxThreads=150 minSpareThreads=4/
--


!-- A Connector represents an endpoint by which requests are received
 and responses are returned. Documentation at :
 Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
 Java AJP  Connector: /docs/config/ajp.html
 APR (HTTP/AJP) Connector: /docs/apr.html
 Define a non-SSL HTTP/1.1 Connector on port 8080
--
Connector port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /
!-- A Connector using the shared thread pool--
!--
Connector executor=tomcatThreadPool
   port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /
--   
!-- Define a SSL HTTP/1.1 Connector on port 8443
 This connector uses the JSSE configuration, when using APR, the 
 connector should be using the OpenSSL style configuration
 described in the APR documentation --
!--
Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true
   maxThreads=150 scheme=https secure=true
   clientAuth=false sslProtocol=TLS /
--

!-- Define an AJP 1.3 Connector on port 8009 --
Connector port=8009 protocol=AJP/1.3 

Re: tomcat virtual host

2008-11-20 Thread mtail


I agree with the other response: rename your war to ROOT.war, so that it is 
the root web application.
By the way, it is worth changing only one thing at once in your URL when 
testing.  You are changing two.
Does http://localhost:8080/ work?
Does http://mysvn:8080/svnrepository work?

But if i do this, how can i access de tomcat manager ? with other name, but the 
examples will work ?

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat virtual host

2008-11-20 Thread mtail

- Mail Original -
De: Charles R Caldarale [EMAIL PROTECTED]
À: Tomcat Users List users@tomcat.apache.org
Envoyé: Jeudi 20 Novembre 2008 16:23:40 GMT +01:00 Amsterdam / Berlin / Berne / 
Rome / Stockholm / Vienne
Objet: RE: tomcat virtual host

 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Subject: Re: tomcat virtual host

 But if i do this, how can i access de tomcat manager ? with
 other name, but the examples will work ?

By using their URLs?

http://mysvn:8080/manager/html
http://mysvn:8080/examples

But, if a want to add a second application web , for example mysvn2 and i do 
not remove the mysvn,
that is why I would like to use the virtual host.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: tomcat virtual host

2008-11-20 Thread mtail


Sorry, but your question does not make any sense to me.

I don't see anything stopping you from adding as many virtual hosts as you 
want.  If you need a different default webapp for each virtual host, then 
each Host will have to specify a different appBase attribute.  Any webapps 
that you want to be visible on multiple virtual hosts will either need to be 
deployed under each appBase, or have a Context element in 
conf/Catalina/[host]/[appName].xml that provides a docBase attribute 
pointing to the location of the webapp.

 - Chuck

I configured localy a virtual host with tomcat 6
This url works :
http://localhost:8080/svn/

But when i use the virtual host, it does not works :
http://mysvn:8080/

Find file attached server.xml please :
Thank's
?xml version='1.0' encoding='utf-8'?
!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the License); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an AS IS BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--
!-- Note:  A Server is not itself a Container, so you may not
 define subcomponents such as Valves at this level.
 Documentation at /docs/config/server.html
 --
Server port=8005 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener /
  Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  !-- Global JNDI resources
   Documentation at /docs/jndi-resources-howto.html
  --
  GlobalNamingResources
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users
--
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
  factory=org.apache.catalina.users.MemoryUserDatabaseFactory
  pathname=conf/tomcat-users.xml /
  /GlobalNamingResources

  !-- A Service is a collection of one or more Connectors that share
   a single Container Note:  A Service is not itself a Container, 
   so you may not define subcomponents such as Valves at this level.
   Documentation at /docs/config/service.html
   --
  Service name=Catalina
  
!--The connectors can use a shared executor, you can define one or more named thread pools--
!--
Executor name=tomcatThreadPool namePrefix=catalina-exec- 
maxThreads=150 minSpareThreads=4/
--


!-- A Connector represents an endpoint by which requests are received
 and responses are returned. Documentation at :
 Java HTTP Connector: /docs/config/http.html (blocking  non-blocking)
 Java AJP  Connector: /docs/config/ajp.html
 APR (HTTP/AJP) Connector: /docs/apr.html
 Define a non-SSL HTTP/1.1 Connector on port 8080
--
Connector port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /
!-- A Connector using the shared thread pool--
!--
Connector executor=tomcatThreadPool
   port=8080 protocol=HTTP/1.1 
   connectionTimeout=2 
   redirectPort=8443 /
--   
!-- Define a SSL HTTP/1.1 Connector on port 8443
 This connector uses the JSSE configuration, when using APR, the 
 connector should be using the OpenSSL style configuration
 described in the APR documentation --
!--
Connector port=8443 protocol=HTTP/1.1 SSLEnabled=true
   maxThreads=150 scheme=https secure=true
   clientAuth=false sslProtocol=TLS /
--

!-- Define an AJP 1.3 Connector on port 8009 --
Connector port=8009 protocol=AJP/1.3 redirectPort=8443 /


!-- An Engine represents the entry point (within Catalina) that processes
 every request.  The Engine implementation for Tomcat stand alone
 analyzes the HTTP headers included with the request, and passes them
 on to the appropriate Host (virtual host).
 Documentation at /docs/config/engine.html --

!-- 

Re: tomcat virtual host

2008-11-20 Thread mtail

 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Subject: Re: tomcat virtual host

 I configured localy a virtual host with tomcat 6
 This url works :
 http://localhost:8080/svn/

 But when i use the virtual host, it does not works :
 http://mysvn:8080/

What do you mean by does not work?  Do you get a 404 status, or does 
something else happen?  Is the DNS name mysvn defined on the machine your 
browser is running on?

Internet Explorer could not display this web  page
i test this in local machine, so i do not use a DNS.

 - Chuck


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]