sudo apt-get install libapache2-mod-jk
2. Enable mod_jk loading: Create a link in /etc/apache2/mods-enabled/jk.load which points to /etc/apache2/mods-available/jk.load. This will enable loading mod_jk module in apache when apache is restarted.
3. Create mod_jk conf file: Create a mod_jk conf file and place it in /etc/apache2/mods-available/jk.conf
# Where to find workers.properties
# Update this path to match your conf directory location
JkWorkersFile /etc/apache2/jk_workers.properties
# Where to put jk logs
# Update this path to match your logs directory location
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the 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"
# Shm log file
JkShmFile /var/log/apache2/jk-runtime-status
4. Enable mod_jk configurations: Create a link in /etc/apache2/mods-enabled/jk.conf which points to /etc/apache2/mods-available/jk.conf. This will enable mod_jk configuration in apache when apache is restarted.# Update this path to match your conf directory location
JkWorkersFile /etc/apache2/jk_workers.properties
# Where to put jk logs
# Update this path to match your logs directory location
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the 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"
# Shm log file
JkShmFile /var/log/apache2/jk-runtime-status
5. Create a worker properties file: Create a workers properties file and place it in /etc/apache2/jk_workers.properties
# Define 1 real worker named ajp13
worker.list=ajp13
# Set properties for worker named ajp13 to use ajp13 protocol,
# and run on port 8009
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=10
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=1
worker.ajp13.socket_timeout=300
worker.list=ajp13
# Set properties for worker named ajp13 to use ajp13 protocol,
# and run on port 8009
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=10
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=1
worker.ajp13.socket_timeout=300
6. Configure url forwarding in apache to tomcat: Put the following lines in you apache virtualhost to forward requests to tomcat.
<VirtualHost *:80>
...
# Send everything for context "/context" to worker ajp13
JkMount /context/ ajp13
JkMount /context/* ajp13
...
</VirtualHost>
<Service name="Catalina">
...
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
...
</Service>
...
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
...
</Service>
8. Restart the tomcat and apache server: Relax you are done.
23 comments :
Step two should point to /usr/lib/apache2/modules/mod_jk.so, not /etc/apache2/mods-enabled/jk.load
Worked perfectly! Thanks!
Well done, thanks a heap! You should go put your stuff on the ubuntu help area.
After going through all the steps i kept on getting an internal server error, until I ran
sudo a2enmod proxy_ajp
and
sudo a2enmod proxy_http
Thanks so much this worked for me
Man, we really help me a lot! tks so much!
regards from Brazil!
If I want to add one more node to workers.properties, Can I do it without restart/graceful apache.
I need a run-time update in workers.properties file.
Thanks in Advance...
I went through a couple of tutorials that I found online and was about to give up on this venture, but then I found this one and it worked.
Thanx
Very well explained. I am making a FAI installation with apache maybe it could be interesting for the community: http://fai-project.org/ some months ago it was completely unknown to me. It allows Fully Automated Installations of Debian and Ubuntu
Thanks. It works like a cake
It took me hours to debug this:
in step 6, instead of
JkMount /context/ ajp13
use this:
JkMount /context ajp13
otherwise it wont work for "context" (without a slash).
Awesome job Rajeev! I have done this setup several times but never got a chance to document it this well; if anyone asks me about this setup, I generally point them to your (this) page... So today thought to drop in a word of thanks and appreciation for your blog.
Thanks!
GT
How to create link ? step 2 and stop 4 ? please help me.
Nice tutorial....
Remove this from jk.conf if available and don't want to use
#
# Inside Location we can omit the URL in JkMount
# JkMount jk-status
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
#
#
# Inside Location we can omit the URL in JkMount
# JkMount jk-manager
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
#
Hi Rajeev
I got the following error. Please suggest me.
Syntax error on line 3 of /etc/apache2/mods-enabled/jk.conf:
JkWorkersFile only allowed once
Action 'configtest' failed.
The Apache error log may have more information.
failed!
"Arun R Upadhya said... How to create link ? step 2 and stop 4 ? please help me."
Here is one way...
In terminal,
1. sudo nautilus
2. navigate to the file you want to link, right click on that file and “Create Link”. This will place a link to your file exactly where you are. Now take the link (cut: CTRL+X) and paste (CTRL+V) it the folder you want it at.
In terminal,
3. exit.
WARNING: Do NOT make any other changes than this in nautilus unless you know what YOU are doing. It can cause a major headache!
* This error drove me crazy!!!
Syntax error on line 9 of /etc/apache2/httpd.conf:
JkWorkersFile only allowed once
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
*To solve this,
$ sudo vim /etc/apache2/mods-enabled/jk.conf
# JkWorkersFile /etc/libapache2-mod-jk/workers.properties
This has worked perfectly for me. Thanks a lot.
I've been trying to modify our sql server support with the Ubuntu platform and I must say that this article has been very generous with information. Thanks a million!
Thanks a bunch for this information! At last, I have something to back me up for a little review I have prepared for my virtual executive assistant. I'm also an amateur to Ubuntu.
Thanks for sharing, it worked for me like a charm!
This had been very helpful to me. I think Ubuntu can be easily maximized to fit the demands of digital marketing.
Post a Comment