0

I can only find information on mod_jk for this, but I think I can't be the only who wants to do this and hopefully someone already does.

I have a single apache httpd server that already has proxy ajp connecting to a glassfish 3.1.2 domain via port 8009. I want to add a couple more domains with different code on the same glassfish server and have the httpd proxy those as well.

I am kind of stuck as I am not even sure where to begin due to the lack of info. This is running on a VPS, and I'll am/will be using virtual domains on apache2.

Bill Rosmus
  • 2,941
  • 7
  • 40
  • 61

1 Answers1

0

I encountered the same problem and I suppose other will too.

Hereby my solution:

You need to create virtual servers on your glassfish, set the right root-module and forward your request with the full url.

  1. Create a specific virtual server

    • In your Glassfish admin interface, goto

      configuration > server-config (default) > Virtual Server

    • Select new

    • Fill in values

      • Id:name of the virtual server, I used the same as host (my.sample.com)
      • hosts:the domain you wish to map (my.sample.com)
      • Network listeners:on which ports the domain will listen (http-listener1)
      • Default Web-Module:your module (mysuperapp_R1.1)

Be sure your app is deployed to the config (server-config by default) and your domain resolves to the server. You can easily test your setup by going to http://my.sample.com:8080/ (suposing that the app runs on 8080). Your app should be working.

2) Forward the request in apache. (on debian, but should be similar for other distros), create a my.sample.com-file (can be anything, but this is very explicit) in /etc/apache2/sites-available with following content (change domain-name of course)

<VirtualHost *:80>
ServerName my.sample.com
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
<Location />
    ProxyPass http://my.sample.com:8080/
    ProxyPassReverse http://my.sample.com:8080/
</Location>
</VirtualHost>

enable the config and reload apache (on Debian, following commands should work)

a2ensite my.sample.com
/etc/init.d/apache2 reload

I did not use AJP because of a conflict I had with Primefaces GMap Module. Of course, changing from proxy to AJP ain't the hard part. Just be sure to have also selected the JK-enabled nework-listeners for the virtual server.

How to enable mod-proxy or mod ajp proxy on apache, just google for it :)

Luc S.
  • 1,144
  • 10
  • 7