Tomcat and virtualHost

Hello,

I have installed, tomcat link to apache with mod_jk.

It works fine but I’d like to know what could be the best config to allow some vhost to use jsp/servlet and others not. In fact the pbm remain even if I allow ALL siteworx account to develop jsp/servlet. How to define a context for every siteworx account (basicly for every or each I should say, vhost) ?

Our first idea is this one :

Create a context per user in the webapps directory of tomcat (for exemple /usr/local/tomcat/webapp/user1 /usr/local/tomcat/webapp/user2)

then ln the /usr/local/tomcat/webapp/user2 to somewhere like /home/user1/domain/java (for exemple)

and finally use these directives in the vhost conf file
JkAutoAlias
jkmount

But we not sure it is the best way

I think the best way should be using the servr.xml to define multiple host and define de docBase and context for every host. But in this case we have to manually configure this for evezry accounts.

Does some of you already configure tomcat in an Inteworx box ?

Or does interworx or nexcess have already done this and could give us some advises ?

Thanks

Pascal

Hello Pascal,

We have a lot of tomcat jvms running on our interworx servers.

Basically we use mod_jk like you mentioned, however we place to jvm and tomcat in users virtual account /home/username/usr/java/jvm and tomcat at /home/username/domain.com/tomcat

It involved manual setting up and configurations for each site plus unique port number. You will need to configure the server.xml for each site with it own port.

You also need to configure the ram usage too. Requires heavy duty servers. Our servers are dual xeons with 6gb of ram. If you use servers with less ram - you end up losing money as you cant fit many jvms on it.

Our systems with interworx and tomcat has been working quite efficiently.

Hi John,

It’s exactly the direction I was looking for…
So a big thank you

So you create a JVM for every account, like this this account is able to restart the jvm, right ?
Do you mean you create a Tomcat for every users (I mean a server.xml for every accounts), or are you talking about the context/webapps ?

I’m really sorry if I explain this badly, in English it is not so easy for me.

What disturbs me is the fact to manually edit all files, but why not…

We also have Bi-xeon (last generation of dualcore 51xx) with 8Gb of ram, so it should be ok

Thanks again for your advises

Could I PM you if I need ?

Pascal

Hello Pascal,

You’re welcome to pm me.

Hello

I’m very interesting by this !

Kipper3d or others could maybe answer some of our questions

Do you mean you set up a normal setup of java and tomcat then you define [SIZE=1]CATALINA_BASE in the user virtual accounts and let [/SIZE][SIZE=1][SIZE=1]CATALINA_HOME in the default install dir ?[/SIZE]

[SIZE=1]This allow to have one Tomcat JVM instance per user, and so to setup the jvm/tomcat differently for every users ![/SIZE]

[SIZE=1]This way allow to have a server.xml, config files, etc per user and also allow to setup the heap memory of the jvm in a specific startup script (by exporting JAVA_OPTS= [FONT=TheSansMonoCondensed-SemiLight][SIZE=1]-Xms384M etc)[/SIZE]
Ok with this install every user would have their own server.xml and a specific reboot port and connector port
[/SIZE][/FONT][/SIZE]If you use this kind of setup, do set the CATALINA_BASE in /home/username/domain.com/tomcat and the default host to domain.com with the webapp path set to /home/username/domain.com/tomcat/webapp ?

Do you use a jvsc wrapper to start tomcat under the user id ?
What about the owner/group of the tomcat and jvm ? do you set the user as the owner of all files ?
Do you allow the user to change the server.xml (and so might change the connector/reboot ports ) ?
How do you start all these instances ?

But maybe you mean you install a complete java and tomcat in every users virtual account ?

If you could just give some good directions it would be very very cool :slight_smile:

Indeed our first idea is to set a different catalina_base per user and setup differents startup scripts to set differents memry heap depending on our offers, byt maybe there is better solutions, and your return will be grzeat !

Thanks a ton by advance
Debowsky

(ps we are french so excuse me if I write a bad english)