Found a solution!
Anonymous gave me a good hint of mod_jk. So, the full configuration (for RHEL5).
First of all, download the mod_jk module for apache: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/x86_64/
Insert / etc / httpd / modules into the modules directory and make it executable:
chmod +x mod_jk-1.2.31-httpd-2.2.x.so
After that create /etc/httpd/conf/workers.properties:
# 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
Port 8009 is where the jk Glassfish connector is listened to (we come to it later).
No, we need to configure mod_jk, so create a file: /etc/httpd/conf.d/mod_jk.conf with the following contents:
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.x.so JkWorkersFile /etc/httpd/conf/workers.properties
(This means that everything from http://apache.webserver.com/yourapp-war/ will be redirected to the context of the Glassfish yourapp-war application)
Important, if you use virtual hosts on apache, you need to set this parameter: JkMountCopy On for your virtual servers. Explication:
If this directive is set to "On" in some virtual server, mounts from the global server will be copied to this virtual server, more precisely, all mounts defined by JkMount or JkUnMount.
Now we need to create a jk connector in a glass fish:
asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-connector asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true
Restart Glassfish and everything will work.