Hello All,

I've installed "Apache httpd +mod_jk and tomcat with multiple virtual hosts"
Used primarily those 2 manuals
http://www.alwayssunny.com/blog/?p=174
http://www.howtoforge.com/apache2_tomcat5_mod_jk_p2

and a lot of reading through apache docs.

The virt. domains working and java requests processed by tomcat
through apache httpd.

Now I need to deply java application called Sakai
(http://source.sakaiproject.org/release/2.6.1/artifacts/sakai-bin-2.6.1.tgz)
in
DocumentRoot of one of my virtual domains.

I can't find any documentation on deploying Sakai in similar environment :(
They all talking about downloading the archive into $CATALINA_HOME and
then unpacking the archive. Then start up Tomcat
- 
http://confluence.sakaiproject.org/display/DOC/Install+Guide+-+Binary+Install+(2.6)

When I extract sakai-bin-2.6.1.tgz into /srv/myserver029 (Vitual
domain's DocumentRoot) and restart tomcat and apache I'm getting -
"HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.
Apache Tomcat/5.5.26
"
Which probably means that the app. is not deployed.
Can someone tell me how to install and configure Sakai or any other
similar application in virt. domain ?
There must be some WEB_INF/web.xml config I should use?
May be some parameters in the main server.xml file?

Thanks.
Here are some of my configs realted to apache httpd+tomcat+virt
domains integration:

# cat /etc/httpd/conf/workers.properties:

#
# This file provides minimal jk configuration properties needed to
# connect to Tomcat.
#
# We define a workers named worker1 and worker2 for 2 different virt. domains
workers.tomcat_home=/opt/tomcat/
workers.java_home=/usr/java/jdk
ps=/
worker.list=worker1,worker2
worker.worker1.type=ajp13
worker.worker1.host=myserver029.somedomain.com
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker2.type=ajp13
worker.worker2.host=sakai26.dyndns.org
worker.worker2.port=8009
worker.worker2.lbfactor=1

# Load-balancing behaviour
worker.loadbalancer.type=lb

# Status worker for managing load balancer
worker.status.type=status

Snap from httpd.conf:

LoadModule jk_module modules/mod_jk.so
# mod_jk config
# Where to find workers.properties
# Update this path to match your conf directory location (put
workers.properties next to httpd.conf)
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/httpd/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put
mod_jk.log next to access_log)
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Globally deny access to the WEB-INF directory
<LocationMatch '.*WEB-INF.*'>
AllowOverride None
deny from all
</LocationMatch>

Virt. hosts configs:

<VirtualHost *:80>
ServerName myserver029.somedomain.com
ServerAdmin ad...@somedomain.com

DocumentRoot /srv/myserver029

# ServerAlias www.myserver029.somedomain.com
# if not specified, the global error log is used
ErrorLog /var/log/httpd/myserver029.somedomain.com-error_log
CustomLog /var/log/httpd/myserver029.somedomain.com-access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off

# Add index.jsp to DirectoryIndex files
DirectoryIndex index.php index.html index.htm index.shtml index.php4
index.php3 index.phtml index.cgi index.jsp

JkMount /* worker1
JkMount /*.jsp worker1

# Im doing it globally in httpd.conf so no need to do this on domain
basis - deny access to the WEB-INF directory

# <LocationMatch '.*WEB-INF.*'>
# AllowOverride None
# deny from all
# </LocationMatch>
</VirtualHost>


For my second virtual host, I created the following configuration file
under /etc/httpd/conf/vhosts.d/02sakai26.dyndns.org.conf

<VirtualHost *:80>
ServerName sakai26.dyndns.org
ServerAdmin ad...@somedomain.com

DocumentRoot /srv/sakai26

ServerAlias www.sakai26.dyndns.org
# if not specified, the global error log is used
ErrorLog /var/log/httpd/sakai26.dyndns.org-error_log
CustomLog /var/log/httpd/sakai26.dyndns.org-access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off

# Add index.jsp to DirectoryIndex files
DirectoryIndex index.php index.html index.htm index.shtml index.php4
index.php3 index.phtml index.cgi index.jsp

JkMount /* worker2
JkMount /*.jsp worker2

# Im doing it globally in httpd.conf so no need to do this on domain
basis - deny access to the WEB-INF directory

# <LocationMatch '.*WEB-INF.*'>
# AllowOverride None
# deny from all
# </LocationMatch>
</VirtualHost>



Configuration of mod_jk listener in tomcat

In order for tomcat to listen for the workers you defined you need to
add a line like this to the engine element on your tomcat server.xml
file.
# vi /opt/tomcat/conf/server.xml
Inside <Engine name="Catalina" defaultHost="localhost">
Just before the </Engine> tag:

<Listener className="org.apache.jk.config.ApacheConfig"
modJk="/usr/lib64/httpd/modules/mod_jk.so"
workersConfig="/etc/httpd/conf/workers.properties"/>

Don’t forget to modify the paths for your system.


In /opt/tomcat/conf/server.xml

For each domain you now need to create a new tomcat host. The name of
each host should correspond with the host you defined in each of your
workers.

I copied the host element from the default host. Here are my host
elements. More info on host elements can be found here.

I did it like this - inside a Host element in the main conf/server.xml
(I think the first is better)

........</Host>
<Listener className="org.apache.jk.config.ApacheConfig"
modJk="/usr/lib64/httpd/modules/mod_jk.so"
workersConfig="/etc/httpd/conf/workers.properties"/>

<Host name="myserver029.somedomain.com"
appBase="/srv/myserver029"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path="" docBase="" debug="1"/>
</Host>

<Host name="sakai26.dyndns.org"
appBase="/srv/sakai26"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Context path="" docBase="" debug="1"/>
</Host>

</Engine>

</Service>

</Server>

Unleashing the Beast; Starting Apache & Tomcat

Now test to make sure the Apache configuration is correct and that it
can successfully start up with the JK Connector configuration:
#/etc/init.d/httpd configtest

Restarting servers
/etc/init.d/httpd start
/etc/init.d/tomcat start

Testing

copy one the following dir to apropriate doamins:

cp -R /opt/tomcat/webapps/jsp-examples /srv/myserver029/
cp -R /opt/tomcat/webapps/servlets-examples /srv/sakai26/

Create index.jsp in /srv/myserver029/:
# cat index.jsp
<html>
<head>
<title>My big ole bad page!</title>
</head>
<body>
Hello Vear029! The time is now <%= new java.util.Date() %>
</body>
</html>

and index.html in sakai26:
# cat ../sakai26/index.html
<html>
<head>
<title>My big ole bad page!</title>
</head>
<body>
Hello Sakai26!
</body>
</html>

Go to http://myserver029.somedomain.com

All working including jsp-examples!!!!

Now how can I install Sakai to /srv/myserver029 directory???

Any help?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to