Server.xml Host Configuration

View: New views
7 Messages — Rating Filter:   Alert me  

Server.xml Host Configuration

by Tomcat User6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi All,

I am new to configuring Server.xml for tomcat. I am using Tomcat 6.0. I have an application called Roller from apache for blogging purposes. I want to configure its host by forum.abc123.com. I did the configuration as below:

<Host name="forum.abc123.com"
  appBase="/usr/local/apache-tomcat-6.0.16/webapps/roller"
  unpackWARs="true" autoDeploy="true"
  xmlValidation="false" xmlNamespaceAware="false">
  <Alias>forum.abc123.com</Alias>

   <Context docBase="" path="/" />
  <Valve className="org.apache.catalina.valves.AccessLogValve"
    directory="logs"
    prefix="local_roller_access_log."
    suffix=".txt"
    pattern="common"
    resolveHosts="false"/></Host>


This application is under the "/usr/local/apache-tomcat-6.0.16/webapps/roller" directory and that is not a WAR file but a directory. When I clicked on Web URL with forum.abc123.com, it is showing me site but with no colors and styles as they are in original. Log sile says that it is not finding any of the files and that is why none of the links on the first page are aslo working.

I am sure that, i am doing something wrong in configuration. Please help me out.

Thank you in advance.

RE: Server.xml Host Configuration

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Tomcat User6 [mailto:SPATEL@...]
> Subject: Server.xml Host Configuration
>
> <Host name="forum.abc123.com"
>   appBase="/usr/local/apache-tomcat-6.0.16/webapps/roller"

Change appBase to "/usr/local/apache-tomcat-6.0.16/webapps"; appBase must never point directly to a specific webapp.

>   <Alias>forum.abc123.com</Alias>

Remove the <Alias>, since it's the same as the <Host> name.  In fact you can probably just leave the <Host> name as "localhost", as long as DNS routes forum.abc123.com to an IP address on your box.  If you are going to change the <Host> name, make sure the defaultHost attribute of the <Engine> points to a valid <Host> element.

>    <Context docBase="" path="/" />

Remove the <Context> element; it should never be placed in server.xml and you don't need one.

> This application is under the
> "/usr/local/apache-tomcat-6.0.16/webapps/roller" directory

Change the name of the directory to ROOT (case sensitive), rather than roller.  Remove the existing ROOT directory, if you haven't already done so.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Server.xml Host Configuration

by Tomcat User6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

THANK YOU SO MUCH. IT'S A GREAT HELP.
Caldarale, Charles R wrote:
> From: Tomcat User6 [mailto:SPATEL@DIGITAS.COM] > Subject: Server.xml Host Configuration > > appBase="/usr/local/apache-tomcat-6.0.16/webapps/roller" Change appBase to "/usr/local/apache-tomcat-6.0.16/webapps"; appBase must never point directly to a specific webapp. > forum.abc123.com Remove the , since it's the same as the name. In fact you can probably just leave the name as "localhost", as long as DNS routes forum.abc123.com to an IP address on your box. If you are going to change the name, make sure the defaultHost attribute of the points to a valid element. > Remove the element; it should never be placed in server.xml and you don't need one. > This application is under the > "/usr/local/apache-tomcat-6.0.16/webapps/roller" directory Change the name of the directory to ROOT (case sensitive), rather than roller. Remove the existing ROOT directory, if you haven't already done so. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org

RE: Server.xml Host Configuration

by Radcliffe, William H. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Caldarale, Charles R
> Subject: Server.xml Host Configuration

> Remove the <Context> element; it should never be placed in server.xml and
you don't need one.

As an addendum.  If you want to remove the <Context> element but still create
an access log, you can create a context.xml file.


Place it as follows (from
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html):

$CATALINA_HOME/conf/context.xml file: the Context element information will be
loaded by all webapps

$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the
Context element information will be loaded by all webapps of that host

$CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file
(less the .xml extension) will be used as the context path. Multi-level
context paths may be defined using #, e.g. context#path.xml. The default web
application may be defined by using a file called ROOT.xml. [In your case,
you would call it ROOT.xml]

/META-INF/context.xml inside the application files


In your case it would be pretty simple.  If you place the file at
"$CATALINA_HOME/conf/[enginename]/[hostname]/", ROOT.xml would contain the
following:

<Context>
  <Valve className="org.apache.catalina.valves.AccessLogValve"
    directory="logs"
    prefix="local_roller_access_log."
    suffix=".txt"
    pattern="common"
    resolveHosts="false"/>
</Context>

In this configuration, you shouldn't need the "path" attribute, and if you
set appBase correctly, you shouldn't need "docBase."

-- Bill

-----Original Message-----
From: Tomcat User6 [mailto:SPATEL@...]
Sent: Monday, July 21, 2008 2:02 PM
To: users@...
Subject: Server.xml Host Configuration



Hi All,

I am new to configuring Server.xml for tomcat. I am using Tomcat 6.0. I have
an application called Roller from apache for blogging purposes. I want to
configure its host by forum.abc123.com. I did the configuration as below:

<Host name="forum.abc123.com"
  appBase="/usr/local/apache-tomcat-6.0.16/webapps/roller"
  unpackWARs="true" autoDeploy="true"
  xmlValidation="false" xmlNamespaceAware="false">
  <Alias>forum.abc123.com</Alias>

   <Context docBase="" path="/" />
  <Valve className="org.apache.catalina.valves.AccessLogValve"
    directory="logs"
    prefix="local_roller_access_log."
    suffix=".txt"
    pattern="common"
    resolveHosts="false"/></Host>


This application is under the
"/usr/local/apache-tomcat-6.0.16/webapps/roller" directory and that is not a
WAR file but a directory. When I clicked on Web URL with forum.abc123.com, it
is showing me site but with no colors and styles as they are in original.
Log sile says that it is not finding any of the files and that is why none of
the links on the first page are aslo working.

I am sure that, i am doing something wrong in configuration. Please help me
out.

Thank you in advance.

--
View this message in context:
http://www.nabble.com/Server.xml-Host-Configuration-tp18575305p18575305.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Server.xml Host Configuration

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Radcliffe, William H. [mailto:RadcliffeWH@...]
> Subject: RE: Server.xml Host Configuration
>
> As an addendum.  If you want to remove the <Context>
> element but still create an access log, you can create
> a context.xml file.

Note that the OP's AccessLogValve was inside the <Host>, not the <Context>, and can stay where it is.  Again, no <Context> is needed for the desired setup.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Server.xml Host Configuration

by Radcliffe, William H. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>From: Caldarale, Charles R [mailto:Chuck.Caldarale@...]
>Subject: RE: Server.xml Host Configuration
>
>Remove the <Context> element; it should never be placed in server.xml and
you don't need one.

If he wants to have an access log, he needs the <Valve> element.  The <Valve>
element was inside <Context>, <Context> was in <Host>.  If he removed the
<Context> element, <Valve> would go with it.  <Valve> can be placed inside
<Engine>, <Host>, or <Context>.  Maybe you meant to say delete "<Context>"
and "</Context>" from server.xml, placing <Valve> directly inside <Host>.

Placing <Valve> inside <Host> will log access to every web app defined for
that virtual host.  Right now he only seems to have one web app.  If there is
only one hosted web app, the access log would contain the same information
whether the <Valve> is in <Host> or <Context>.  As a matter of fact, if this
is his only <Host> element, the access log would contain the same information
if <Valve> were inside <Engine>.

It all depends on his intent.  If he wants to limit logging to a particular
web app, I would suggest placing the <Valve> inside <Context>.  It would be a
good habit to develop.  This way, if he ever decides to add another web app
to this host, and he wants a separate access log, he has a template to work
from.  Otherwise, if he wants to log all access to a virtual host, place
<Valve> inside <Host>.  If he wants to log all access to a Tomcat server
instance, place <Valve> inside <Engine>.

-Bill

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@...]
Sent: Tuesday, July 22, 2008 8:35 AM
To: Tomcat Users List
Subject: RE: Server.xml Host Configuration

> From: Radcliffe, William H. [mailto:RadcliffeWH@...]
> Subject: RE: Server.xml Host Configuration
>
> As an addendum.  If you want to remove the <Context> element but still
> create an access log, you can create a context.xml file.

Note that the OP's AccessLogValve was inside the <Host>, not the <Context>,
and can stay where it is.  Again, no <Context> is needed for the desired
setup.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@... To unsubscribe, e-mail:
users-unsubscribe@...
For additional commands, e-mail: users-help@...



---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Server.xml Host Configuration

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Radcliffe, William H. [mailto:RadcliffeWH@...]
> Subject: RE: Server.xml Host Configuration
>
> If he wants to have an access log, he needs the <Valve>
> element.  The <Valve> element was inside <Context>

Look at the original post more carefully:
http://marc.info/?l=tomcat-user&m=121666697029041&w=2

   <Context docBase="" path="/" />
  <Valve className="org.apache.catalina.valves.AccessLogValve"
    directory="logs"
    prefix="local_roller_access_log."
    suffix=".txt"
    pattern="common"
    resolveHosts="false"/>

The <Valve> is clearly outside of the <Context> element.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price