viernes, 3 de febrero de 2012

Integrar Glassfish con Apache Web Server

1.- Descargamos el MOD JK
http://mirrors.sonic.net/apache//tomcat/tomcat-connectors/jk/

2.- Copiar el mod_jk.so a /usr/lib64/httpd/modules
3.- Dar permisos al mod_jk.so
chmod 775 mod_jk.so

4.- Copiar el workers.properties a /etc/httpd/conf

------------------------------------
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
------------------------------------

5.- En el workers.properties cambiar el host

6.- Modificar el httpd.conf y agregar estas lineas al comienzo

_____________________
LoadModule jk_module modules/mod_jk.so

JkWorkersFile "/etc/httpd/conf/workers.properties"

# Where to put jk logs
JkLogFile logs/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 %U %q"

# Send all jsp requests to GlassFish
JkMount /*.jsp worker1

# Send all /TestWeb/ requests to GlassFish
JkMount /TestWeb/* worker1
___________________________

7.- Agregamos el siguiente listener en el glassfish
asadmin --user admin --host localhost --port 4848 create-http-listener --listeneraddress 0.0.0.0 --listenerport 8009 --defaultvs server jk-connector-8009

8.- Activamos el listener

asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true

9.- Cambiar el Owner del /var/www/html a tu usuario con el que utilizas el levantas el Glassfish
chown -R usrgf /var/www/html

10.- Reiniciar el apache y ver el log
/var/log/httpd
/etc/init.d/httpd start