Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17819

[Cross-post: r/apache] Tomcat and mod_jk, need help setting up the connection to apache-httpd

$
0
0

Original Link.

Original Text

So I've been working on this for something close to six hours now and I'm at a complete loss.

I am running Slackware64 Linux 14.0 on a server machine and trying to set up tomcat in such a way that my users can write jsp pages. I want each user to have their own worker or set of workers.

I've got tomcat installed and tested, I can access example and sample webapps in the $TOMCAT_HOME/webapps directory through port 8080 and they will work.

I've got mod_jk compiled and installed and I've got httpd configured to load the module, which appears to be successful. My mod_jk.conf file currently looks like this:

 # User written file # JK Configuration LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so Alias /talosthoren/ "/home/talosthoren/public_html" <Directory "/home/talosthoren/public_html"> Options Indexes FollowSymLinks </Directory> JkWorkersFile /etc/tomcat/conf/workers.properties JkLogFile /var/log/httpd/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M: %Y]" JkRequestLogFormat "%w %V %T" JkMount /talosthoren/*.jsp talosworker 

I'm not sure if I've got the workers.properties file in the wrong place and I don't quite understand where the worker files live at run time, or how to configure them for individual users. I've tried a few things and the last time I altered my workers.properties file it looked like this:

 workers.list=talosworker worker.talosworker.type=ajp13 worker.talosworker.host=localhost worker.talosworker.port=8009 

I also saw some examples somewhere that led me to add the following to $TOMCAT_HOME/conf/server.xml

<Context path="/opt/talosthoren" docBase="/home/talosthoren/public_html" crossContext="false" debug="3" reloadable="true" > </Context> 

As well as adding the /opt/talosthoren directory. I'm not quite sure what this is supposed to do.

I'm not sure what I'm doing wrong. The documentation seems sparse to me but there are rather a lot of new concepts so I may just be struggling to understand it.

Thanks in advance for any help.

Changes and further Information from comments (thanks to u/johnpatton)

Thanks for your help. That cleared up a lot, actually, but the configuration is still not working. So now I've got this going:

 # Filename: workers.properties workers.list=worker.talosbalancer worker.talosworker.type=ajp13 worker.talosworker.host=localhost worker.talosworker.port=8009 worker.talosbalancer.type=lb worker.talosbalancer.balance_workers=talosworker # worker.talosbalancer.sticky_sessions=True worker.talosbalancer.method=Session 

Which lives in /etc/tomcat/conf/workers.properties. Should this be in $TOMCAT_HOME? I do not have the TOMECAT_HOME environment variable set, should I have it set?

Should 'workers.list' include 'worker.talosworker1' and 'worker.talosworker2' or does just including 'worker.talosbalancer' handle that since it's balancing the workers?

I've also noticed that the tomcat install root, which I gather is equivalent to $TOMCAT_HOME in most of the documentation, has a symbolic link called 'conf' which points to /etc/tomcat. /etc/tomcat itself contains a directory called conf. Should my workers.properties file be in /etc/tomcat or /etc/tomcat/conf, or does that not matter if I point to the correct file?

I also made these changes in my server.xml file:

<!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost" jvmRoute="talosworker"> 

I included the comment just to keep it in context.

<Context path="/opt/talosthoren" docBase="/home/talosthoren/public_html" crossContext="false" reloadable="true" > </Context> 

I removed the debug statement here because I was seeing a warning about it in the log file. It's my understanding this code allows the server to find the documents directory, but I'm not sure how, or why, or if /opt/talosthoren is necessary or why it's there (I just saw it in some code I didn't understand.)

Now I've got a jsp file that looks like this:

<html> <head> <title>JSP Test</title> </head> <body> <h1>Howdy Folks!</h1> <p>Hello, the time is now: <%= new java.util.Date() %> </p> </body> </html> 

This file lives in /home/talosthoren/public_html/JSPTest

When I try to access it I just get the following:

Howdy Folks!

Hello, the time is now: <%= new java.util.Date() %>

I'm working under the understanding that when this is running correctly I will obtain the current date.

submitted by TalosThoren
[link][1 comment]

Viewing all articles
Browse latest Browse all 17819

Trending Articles