Setting Apache server to access Glassfish

Setting Apache server to access Glassfish

There so many cases why somebody might want to set Glassfish server behind Apache, that I won’t list them all.
I think that emotional aspect is the most important here – people feel uncomfortable with ports other, than traditional 80 and 443.

So, I decided, that it would be much better if our server will be not on port 8080, but in root of usual domain.

I started from a wonderful article Setting up Glassfish behind Apache
I followed the steps, listed in the article, but met some issues with setting up mod_jk modile.

Configure Glassfish

Create the listener:

Activate the listener:

Finally, restart the Glassfish Server:

Compile mod_jk

1. download sources from The Apache Tomcat Connector
2. uncompress
3. install http-devel package
4. Configure for build

5. Make binaries

6. Copy library to modules

7. Add to the list of modules in your Apache config

Configuring Apache

Create a file called workers.properties and place it in a safe place (e.g. /etc/httpd/conf.d). Put the following contents in this file:

Then, open your httpd.conf file and put the following contents in it (outside a VirtualHost section). Check the path of your workers.properties file

Also, you need to add a VirtualHost section in your page, in order to map the specific domain/subdomain with the path in Glassfish you want to make visible through Apache:

Set your web module in root of glassfish server

just deploy your war with the following parameter:

If you want to see this configuration in action, open our “Is it kosher? search” web app.