Fronting GlassFish v3 with Apache httpd
http://weblogs.java.net/blog/jfarcand/archive/2008/08/fronting_glassf.html
GlassFish v2 supported Apache httpd for a while...but when we started GlassFish v3, we dropped such support to focus on things like modularity, performance, a monster called Grizzly, etc. Hence previous version of v3 couldn't be used with Apache via Tomcat's mod_jk....that's no longer the case. Better, we have simplified the way to do it. You no longer needs special jars file from Tomcat. Apache support is now fully included inside our distribution, which makes it quite simple to enable. Much simpler that what I've described here
GF v2支持AHS有段时间了...而当我们开始GF v3的开发后,放弃了这样的支持以专注于某些方面,像模块性,性能,以及变态的Grizzly引擎等等.因此v3前面的版本不便和Apache通过Tomcat的Mod_JK一起使用....还好这种情况没有延续太久.而且我们现在实现了这一功能并进行简化了配置.你不再需要从Tomcat的Home下拷贝特别的jar文件.对Apache的支持已经完全整合在我们的发行版里面,相关的配置非常简单.就像下面的描述.
Want to try it? Download GlassFish v3 (wait for tomorrow nightly as I enabled support today) and just edit:
想尝试吗,下载GF v3吧,编辑domain.xml像这样:
% vi ${glassfish.home}/domains/domain1/config/domain.xml
and add under your http-listener:
<http-listener default-virtual-server="server" family="inet"
security-enabled="false" enabled="true" server-name=""
address="0.0.0.0" acceptor-threads="1" port="8009" id="jk-connector"
xpowered-by="true" blocking-enabled="false" >
<property name"jkEnabled" value="[true|false]">
That's it. Notice the port number. That's the one you need to add to your /etc/apache2/worker.properties file.
Haaaa!Much simpler than for GlassFish v2! The implementation is new so feel free to post your comments on the users@glassfish.dev.java.net alias in case you want...more!
Using mod_jk
To set up mod_jk, follow these steps:
-
Obtain and install Apache 2.0.x or 2.2.x HTTP Server (http://httpd.apache.org/).
-
Configure the following files:
Examples of these files are shown after these steps. If you use both worker.properties and glassfish-jk.properties files, the file referenced by httpd.conf, or referenced by httpd.conf first, takes precedence.
-
Start httpd.
-
Enable mod_jk using the following command:
asadmin set server-config.http-service.http-listener.listener.property.jkEnabled=true
|
For example:
asadmin set server-config.http-service.http-listener.http-listener1.property.jkEnabled=true
|
Or you can use the following deprecated command, provided for backward compatibility:
asadmin create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK=8009
|
-
If you are using the glassfish-jk.properties file and not referencing it in httpd.conf, point to it using the following command:
asadmin create-jvm-options
-Dcom.sun.enterprise.web.connector.enableJK.propertyFile=domain-dir/config/glassfish-jk.properties
|
-
Restart the Enterprise Server.
Here is an example httpd.conf file:
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/worker.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# 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"
# Send all jsp requests to GlassFish
JkMount /*.jsp worker1
# Send all glassfish-test requests to GlassFish
JkMount /glassfish-test/* worker1
Here is an example worker.properties or glassfish-jk.properties file:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost.localdomain
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
分享到:
相关推荐
GlassFish V3初探
可扩展GlassFish v3的JavaEE 6帮助文档
引起鱼猫之争的东东 可与tomcat 媲美,看好它
最新的Glassfish v3使用指南,希望大家可以使用愉快。
jmaki development with sun glassfish v3
引起鱼猫之争的东东 可与tomcat 媲美,看好它
Demo of ehCache distributed caching with terracotta in glassFish v3 可以参考:http://blog.csdn.net/guobin0719/archive/2011/04/25/6361940.aspx
GlassFish v3 使用技术文档。很全面很详细。用到什么直接去找,没必要完全掌握
Oracle GlassFish Server 3.1相关资料
glassfish集群的配置在国内很少有人详细的讲 而且细节之处关键之处都是一带而过 很容易忽略 包括官方白皮书也是这样 所以写个文档和大家分享一下 文档中我分别写了界面配置方法和命令行批处理配置方法,希望对研究和...
GlassFish Server 4.1 快速入门指南(阿军译)
glassfish-v3-windows.part1
Java EE 6 with GlassFish 3 Application Server.rar
GlassFish Server 是Java EE的开源参考实现
glassfish-v3-windows.part4
glassfish-v3-windows.part2
Java EE 5 Development using GlassFish Application Server
Java EE 5 with Glassfish Application Server 英文版 (pdf)
Payara Server 源自GlassFish Server开源版本和100%开源
Glassfish 与 Apache 的整合 不多说自己看 会有收获的