LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   SuSE 9.2 - apache2 & tomcat5 - how to configure VIRTUAL HOSTS & JSP? (https://www.linuxquestions.org/questions/linux-networking-3/suse-9-2-apache2-and-tomcat5-how-to-configure-virtual-hosts-and-jsp-299105/)

nicolasdiogo 03-08-2005 07:38 AM

SuSE 9.2 - apache2 & tomcat5 - how to configure VIRTUAL HOSTS & JSP?
 
Hello,

I have installed my SuSE 9.2 pro with a DHCP server, DNS server, and even LDAP authetication (thanks to help found on this forum!).
At present, I have also intalled my apache2 webserver easily, but I can not figure out how to configure tomcat5 to work with my apache2.
Let me make it clear that I have installed both packages, apache2 & tomcat5, accoding to SuSE's descriptions so I have the usual JSP pages working (/jsp-examples/ and /servlets/), however I do not understand how to configure Apache2 VIRTUAL HOSTS to serve JSP pages.
SuSE as you know comes with a mod_jk rpm which is easily installed and remaining of cofiguration is fairly straigth forward thanks to notes in the /var/ directory.
But even after a lot of time searching and reading I still can not setup the server.

I have tried ProxyPass and ProxyPassReturn as an alternative but that did not work.
And also tried [uri:/domainPath/*] configuration, again, without any lucky.

I swear that I have searched, but it seems that I still missing something!?

What I am seeking is to enable the following VIRTUAL HOSTS (with JSP & servlets) to be processed through tomcat5:

<VirtualHost *:80>

<IfDefine SSL>
SSLEngine off
</IfDefine>

DocumentRoot /srv/www/vhosts/brainpowered.net/
ServerName www.brainpowered.net
ServerAdmin admin@brainpowered.net

DirectoryIndex index.jsp index.html


</VirtualHost>



the default jk.conf (/etc/apache2/conf.d/jk.conf) is as follows:

########################start#############################
# simple configuration for apache (for AJP connector, modul mod_jk.so)

<IfModule mod_jk.c>

JkWorkersFile /etc/tomcat5/base/workers.properties
JkLogFile /var/log/tomcat5/base/mod_jk.log

# Log level to be used by mod_jk
JkLogLevel error

# The following line makes apache aware of the location of
# the /servlets-examples context
Alias /servlets-examples "/srv/www/tomcat5/base/webapps/servlets-examples"
<Directory "/srv/www/tomcat5/base/webapps/servlets-examples">
Options Indexes FollowSymLinks
allow from all
</Directory>


# The following line makes apache aware of the location of
# the /jsp-examples context
Alias /jsp-examples "/srv/www/tomcat5/base/webapps/jsp-examples"
<Directory "/srv/www/tomcat5/base/webapps/jsp-examples">
Options Indexes FollowSymLinks
allow from all
</Directory>

# The following line mounts all JSP files and the /servlet/ uri to tomcat
JkMount /servlets-examples/servlet/* ajp13
JkMount /jsp-examples/*.jsp ajp13

# The following line prohibits users from directly accessing WEB-INF
<Location "/jsp-examples/WEB-INF/">
AllowOverride None
deny from all
</Location>
<Location "/servlets-examples/WEB-INF/">
AllowOverride None
deny from all
</Location>

</IfModule>

########################end#############################

And the workers.properties file is:

#######################start#############################

# 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 3 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - 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=/var/tomcat3

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/opt/IBMJava2-13

#
# 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
# , 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=localhost
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 DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# 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=localhost
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

#
#------ 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


#
#------ 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
#
# This is for Java2
#
# Windows
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
# IBM JDK1.3
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so
# Unix - Sun VM or blackdown
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)classic$(ps)libjvm.so

#
# And this is for jdk1.1.X
#
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll


#
# 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
#

#########################end#############################

Many, Many thanks in Advance!

Nicolas

chrisc3616 03-20-2005 07:57 AM

Hi. I'm in the same boat. It looks like it is tomcat5 configured by default. I thought I might have a problem with my router on port 8080 but it should be loading JSPs on port 80. What are you using to test it? Have you checked your logs directory? Try to deploy a war in the webapps and restart tomcat

nicolasdiogo 03-20-2005 08:06 AM

thanks,


i have posted a response to my forum on the link below:

http://www.linuxquestions.org/questi...hreadid=298860

if you need further assistance, let me know.

Nicolas


All times are GMT -5. The time now is 06:20 AM.