You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Frank <fr...@nerd.xs4all.nl> on 2001/04/12 12:29:55 UTC
virtualhosting, is this correct and some (general) questions
Can someone please read this and check if get the concept correct of the
virtual hosting.
I do want every virtual (namebased) host to has it's own tomcat proces.
They are not allowed to
interfere with eachother. I use apache1.3.17/tomcat 3.2.1/mod_jk on Debian
Linux.
Adding a hosts:
Let's say I will use ports 8100-8200 for my virtual hosts.
I want to add two new hosts test01.servlet.com and test02.servlet.com
using port 8101 and 8102.
Both having a connector of the newer Ajp13 type.
a) edit server.xml
If I get it correctly, you use the server.xml and the <Connector> tags to
define a separate tomcat process to be used by for example a virtual web.
This part is not totally clear, you create a connector with a handler of a
certain type, below the Ajp13ConnectionHandler.
But then I think you can only create a worker of the same type pointing to
the port of the connector?
When you want to use workers of a different type, you need to create
connectors of the same type with different portnumbers.
Or is there absolutely no point in having different type connectors for one
"context". Is the type connector directly related to 1 "context" and has
one <Connector>?
If i want as well a connector type ajp12 and ajp13 for a virtualhost, then
I would have to create two Connector's in the server.xml, both having their
own port number? And that means that particular web has two "tomcat"
processes of it's own?
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
<Parameter name="port" value="8101"/>
</Connector>
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
<Parameter
name="handler"
value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
<Parameter name="port" value="8102"/>
</Connector>
<Host name="test01.servlet.com">
<Context path="" docBase="/opt/www/test01.servlet.com/htdocs" debug="0"/>
</Host>
<Host name="test02.servlet.com">
<Context path="" docBase="/opt/www/test02.servlet.com/htdocs" debug="0"/>
</Host>
b) edit the workers.properties file:
worker.list= test01-ajp13 , test02-ajp13
worker.test01-ajp13.port=8101
worker.test01-ajp13.host=localhost
worker.test01-ajp13.type=ajp13
worker.test02-ajp13.port=8102
worker.test02-ajp13.host=localhost
worker.test02-ajp13.type=ajp13
c) edit the apache virtual config:
(and, not shown here, secure the META-INF and the WEB-INF directories below
the htdocs)
<VirtualHost test01.servlet.com>
DocumentRoot /opt/www/test01.servlet.com/htdocs
ServerName test01.servlet.com
JkMount /*.jsp test01-ajp13
JkMount /servlet/* test01-ajp13
</VirtualHost>
<VirtualHost test02.servlet.com>
DocumentRoot /opt/www/test02.servlet.com/htdocs
ServerName test02.servlet.com
JkMount /*.jsp test02-ajp13
JkMount /servlet/* test02-ajp13
</VirtualHost>
Some other questions.
I've added jars for ssl, xml parsing, jdbc to mysql and postgress in the
jre/lib directory under the jdk install and under the lib of the tomcat
directory..I pressume this is overdone? Could it result in problems (except
updates not installed in both locations I pressume).
How can you control memory and cpu resources so no virtual host can take
the down the server and other customers get pissed off. Should I look at
the "normal" resource quota on the os?
After adding a new context, the apache as well as tomcat needs a restart.
But when the tomcat proces of a virtual webservers dies, get killed or
whatever. Does it automatically restart then? Or must tomcat be restarted then?
With using the mod_jk, is it still needed to include the auto-generated
config by tomcat in the apache configuration?
Or are the above directive's enough (including loading of the mod_jk
ofcourse and logdirectives).
Is it normal, possible or feasible to add just one context per virtual
host? And let that be the htdocs file?
Without having to contact a customer about how many or what jsp/servlet
applications he has?
And when a *.war of jsp's are located wherever in beneath the htdocs
directory, what would the url be. Or does every
servlet application explicitly needs his own "context". Something not
wanted due to restarting of the server.
and last but not least, the different worker types. Is it enough for all
servlets and jsp related to virtual hosting just to use the ajp13 type? Of
is it more convenient to add workers of all the different types?
Hopefully someone can make the foggy servlet-tomcat-virtualhosting air
above my head clear up :)
Frank