<span style='font-size:21pt;line-height:100%'><span style='color:green'>
2° Configuration grossière ... </span></span>
Pour commencer ...
bon je referai le ménage dans les deux derniers posts qui sont confus .. tatonnements .. et désolé d'un post si long mais les exemples concrets sont utiles
Voila le résultat obtenu et comment
Pour les fichiers de configurations ... 1° Vous devez avoir <span style='color:blue'>/etc/httpd/conf/httpd.conf</span> # Bring in additional module-specific configuration
#
Include modules.d/*.conf
Include /usr/share/tomcat5/conf/auto/mod_jk.conf
-----------------------------------------------------------------
Car c'est là que Tomcat génère ce fichier .. on peut toujours avec un paramètre le mettre un autre endroit, mais pourquoi compliquer ..
2° Avoir ce fichier ici <span style='color:blue'>/usr/share/tomcat5/conf/jk/workers.properties </span>c'est là que le mod_jk.cong généré le cherche .. .. on peut toujours avec un paramètre le mettre un autre endroit, mais pourquoi compliquer ..
3° <span style='color:blue'>/usr/share/tomcat5/conf/server.xml</span>VOIR le fichier donné comm exemple ci-après..
<span style='color:purple'>L'idée est d'avoir DEUX HOSTS :</span>Host = localhost sur le port 8080 pour les taches admin et manager su
Donc pas de listener .. ici
Host = tombraind sur le port 80 par Apache (tombraind pour moi ce peut etre
http://www.toto.org ou
http://www.toto.org/tomcat)
qui utilise la prise en charge par Apache
ICI un listener, donc un Connector avec Apache et un fichier mod-jk.conf généré.
Donc pour le meme Engine
1° Host localhost Tomcat sans connecteur apache
2° Host (ici tombraind) Tomcat avec connecteur Apache
Ce 2° Host est "include" par Apache (le include dans httpd.conf) et il trouve donc des Virtual Host paramétrés par Tomcat automatiquement.....
Donc, Quand on modifie l'administration/management ou on redémarre Tomcat, il regénère le fichier /usr/share/tomcat5/conf/auto/mod_jk.conf
Derrière Apache Httpd service, doit être redémarré pour prendre ne compte les infos de ce mod_jk.conf
- A SIGNALER les deux paramètres importants : forwardall = "true" ET noroot= "false" POUR que Tomcat gère les fichiers statiques comme les applis jsp
4° NE pas oublier <span style='color:blue'>/etc/hosts.conf</span>127.0.0.1 localhost.locadomain localhost
192.168.xx.yy tombraind.domain.tld tombraind
<span style='color:red'>
Problème restant ..</span>
Démarrage et Arrêt dans le bon ordre de Apache et Tomcat
<span style='font-size:14pt;line-height:100%'>
Les fichiers pour exemple encore grossier mais marchent </span>
<span style='color:red'>/usr/share/tomcat5/conf/tomcat5.conf</span># tomcat4 service configuration file
# you could also override JAVA_HOME here
# Where your java installation lives
JAVA_HOME="/usr/lib/jvm/java"
# You can pass some parameters to java
# here if you wish to
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"
# Where your tomcat installation lives
# That change from previous RPM where TOMCAT_HOME
# used to be /var/tomcat.
# Now /var/tomcat will be the base for webapps only
CATALINA_HOME="/usr/share/tomcat5"
JASPER_HOME="/usr/share/tomcat5"
CATALINA_TMPDIR="/usr/share/tomcat5/temp"
JAVA_ENDORSED_DIRS="/usr/share/tomcat5/common/endorsed"
# What user should run tomcat
TOMCAT_USER="tomcat4"
# You can change your tomcat locale here
#LANG=en_US
# Time to wait in seconds, before killing process
SHUTDOWN_WAIT=30
# Set the TOMCAT_PID location
CATALINA_PID=/var/run/tomcat5.pid
# If you wish to further customize your tomcat environment,
# put your own definitions here
# (i.e. LD_LIBRARY_PATH for some jdbc drivers)
# Just do not forget to export them
<span style='color:red'>/usr/share/tomcat5/conf/jk/workers.properties</span># workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers. Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to do is un-comment and modify the first three
# properties, i.e. workers.tomcat_home, workers.java_home and ps.
# Most of the configuration is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 5 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - An ajp13 worker that connects to localhost:8809
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list property.
#
#
# OPTIONS ( very important for jni mode )
#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/usr/share/tomcat5
#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java
#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
# The workers that your plugins should create and work with
#
# Add 'inprocess' if you want JNI connector
worker.list=ajp12, ajp13, jboss
# , inprocess
#
#------ DEFAULT ajp12 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
# Defining a worker named ajp12 and of type ajp12
# Note that the name and the type do not have to match.
#
worker.ajp12.port=8007
worker.ajp12.host=192.168.10.100
worker.ajp12.type=ajp12
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp12.lbfactor=1
#
#------ DEFAULT ajp13 WORKER DEFINITIONS -----------------------------
#---------------------------------------------------------------------
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=192.168.10.100
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize
#
# Defining a worker named jboss and of type ajp13
#
worker.jboss.port=8809
worker.jboss.host=192.168.10.100
worker.jboss.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.jboss.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.jboss.cachesize
#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13, jboss
#
#------ DEFAULT JNI WORKER DEFINITION---------------------------------
#---------------------------------------------------------------------
#
# Defining a worker named inprocess and of type jni
# Note that the name and the type do not have to match.
#
worker.inprocess.type=jni
#
#------ CLASSPATH DEFINITION -----------------------------------------
#---------------------------------------------------------------------
#
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
#
# Setting the command line for tomcat.
# Note: The cmd_line string may not contain spaces.
#
worker.inprocess.cmd_line=start
# Not needed, but can be customized.
#worker.inprocess.cmd_line=-config
#worker.inprocess.cmd_line=$(workers.tomcat_home)$(ps)conf$(ps)server.xml
#worker.inprocess.cmd_line=-home
#worker.inprocess.cmd_line=$(workers.tomcat_home)
#
# The JVM that we are about to use
#
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)server$(ps)libjvm.so
#
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
#
# Setting the tomcat.home Java property
#
#worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#
# Java system properties
#
# worker.inprocess.sysprops=java.compiler=NONE
# worker.inprocess.sysprops=myprop=mypropvalue
#
# Additional path components.
#
# worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin
#
<span style='color:red'>/usr/share/tomcat5/server.xml</span><?xml version='1.0' encoding='utf-8'?>
<Server>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<span style='color:green'> <Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/lib/httpd/modules/mod_jk.so"/></span>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="Catalina">
<Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
</Connector>
<Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
</Connector>
<Engine defaultHost="localhost" name="Catalina">
<span style='color:green'> <Host appBase="webapps" name="localhost">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
</Host>
<Host appBase="webapps" name="tombraind">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="tombraind_log." suffix=".txt" timestamp="true"/>
<Listener className="org.apache.jk.config.ApacheConfig" append="true" noRoot="false" forwardAll="true" modJk="/usr/lib/httpd/modules/mod_jk.so"/>
</Host></span>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192.168.1.*,127.0.0.1 " deny=""/>
</Engine>
</Service>
</Server>
<span style='color:red'>/usr/share/tomcat5/conf/auto/mod_jk.conf</span>########## Auto generated on Thu Jul 21 00:37:01 CEST 2005##########
<IfModule !mod_jk.c>
LoadModule jk_module "/usr/lib/httpd/modules/mod_jk.so"
</IfModule>
JkWorkersFile "/usr/share/tomcat5/conf/jk/workers.properties"
JkLogFile "/usr/share/tomcat5/logs/mod_jk.log"
JkLogLevel emerg
<VirtualHost tombraind>
ServerName tombraind
JkMount /struts-examples ajp13
JkMount /struts-examples/* ajp13
JkMount /servlets-examples ajp13
JkMount /servlets-examples/* ajp13
JkMount /webdav ajp13
JkMount /webdav/* ajp13
JkMount /jsp-examples ajp13
JkMount /jsp-examples/* ajp13
JkMount /balancer ajp13
JkMount /balancer/* ajp13
JkMount /struts-blank ajp13
JkMount /struts-blank/* ajp13
JkMount /struts-example ajp13
JkMount /struts-example/* ajp13
JkMount /struts-tiles-documentation ajp13
JkMount /struts-tiles-documentation/* ajp13
JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13
JkMount /struts-documentation ajp13
JkMount /struts-documentation/* ajp13
JkMount / ajp13
JkMount /* ajp13
DocumentRoot "/usr/share/tomcat5/webapps/ROOT"
</VirtualHost>