I have been able to use Apache web server to accept jsp petitions using the mod_jk connector, but... Is it possible in this situation configure an Struts2 aplication ? How I should configured ?
1 Answers
mod_jk is used to proxy requests from Apache HTTPD to Apache Tomcat. Since a Struts2 app is just a Java app, configuring it is basically the same as it would be for any Java app.
Since you didn't provide any details on what configuration (if any) you have tried or what specifically you are trying to do, I'll just provide excerpts from the mod_jk configuration for a production app that I work on. You should consult the mod_jk documentation for more details.
mod_jk.conf
This file is the core configuration of mod_jk. It's located in the conf.d directory.
# Load mod_jk module
LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so
# 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] "
workers.properties
This file declares all of the workers (instances of Tomcat) that you are going to proxy to. This example assumes just a single Tomcat instance, named "tomcat."
# Define 1 real worker using ajp13
worker.list=tomcat
# Set properties for tomcat (ajp13)
worker.tomcat.type=ajp13
worker.tomcat.host=localhost
worker.tomcat.port=8009
Apache VirtualHost Configuration
Put this in your Apache configuration, such as inside a <VirtualHost >
block. The name "tomcat" is whatever you defined in your workers.properties. This example would route all requests to Tomcat.
JkMount /* tomcat
Additional
Remember to enable the ajp13 connector within your Tomcat server.xml, as well.

- 10,936
- 3
- 39
- 50