Koozali.org: home of the SME Server

mod_jk on SME 8

Offline tgminc

  • *
  • 15
  • +0/-0
mod_jk on SME 8
« on: January 15, 2014, 01:35:14 AM »
I have been trying to replicate what I had previously setup on SME 7 - mod_jk routing to Tomcat 6 - and I am having issues.

Tomcat is running fine as well as the installed app.

I had to build mod_jk on another Centos 5 box because I could no longer download a pre-built binary - duh! I do not think the resulting binary is an issue as it seems to start up ok.

I have it all configured now and the server starts up ok however, when I try and access a Tomcat app I get the following:

[Tue Jan 14 19:23:45.341 2014] [4125:47462118826864] [debug] jk_translate::mod_jk.c (3605): missing uri map for <domain>:/artifactory/
[Tue Jan 14 19:23:45.341 2014] [4125:47462118826864] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for <domain>:/artifactory/

I am  using the same configuration files I was using on SME 7 that previously worked flawlessly.

The log files also show the following for one of my virtual domains:

[Tue Jan 14 19:28:05.157 2014] [4126:47462118826864] [debug] jk_translate::mod_jk.c (3605): missing uri map for <virtualDomain>:/index.shtml
[Tue Jan 14 19:28:05.157 2014] [4126:47462118826864] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for <virtualDomain>:/index.shtml

I did Google and found what I thought were relevant discussions about JkMountCopy and dialog about virtual domains so I played with it but nadda!

I am wondering if anybody has gotten mod_jk working with Tomcat (or another Java server) on SME 8?

Thanks.

Tom



Offline chris burnat

  • *****
  • 1,135
  • +2/-0
    • http://www.burnat.com
Re: mod_jk on SME 8
« Reply #1 on: January 15, 2014, 10:05:02 AM »
Moving to General Discussion
- chris
If it does not work out of the box, please fill in a Bug Report @ Bugzilla (http://bugs.contribs.org)  - check: http://wiki.contribs.org/Bugzilla_Help .  Thanks.

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: mod_jk on SME 8
« Reply #2 on: January 15, 2014, 04:15:14 PM »
Hi

I'm not sure why you need mod_jk (i'm a guy from INFRA not programming) , could you explain why it's necessary or what you need to do so we can think about other solutions?

I could find a mod_jk rpm here:
http://rpm.pbone.net/index.php3/stat/4/idpl/21761971/dir/centos_5/com/apache2-mod_jk-1.2.37-4.1.x86_64.rpm.html

Not tested...I own all pieces if you broke it! :)

...

Offline Xavier.A

  • ****
  • 104
  • +0/-0
Re: mod_jk on SME 8
« Reply #3 on: January 16, 2014, 12:04:52 AM »
hi,

I use in production Tomcat 7 on SME Server 8 and CentOS 6 servers to use with Scenari servers and other Webapps !

just go to : https://tomcat.apache.org/download-connectors.cgi and here for doc : https://tomcat.apache.org/connectors-doc/

download what u need and what u need is ajp13 :
cd /usr/local/src
wget http://mir2.ovh.net/ftp.apache.org/dist//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz

of course u check pgp and MD5 !

U un-tar the gzip file in the good directory to build it (/usr/local/src), read the doc !

u build it and u copy it in the good module directory (/etc/httpd/modules)

U fixe the rights of this module (chmod and chown)

U won't have to upgrade very often the module, so do u really need a RPM?

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule50 /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
nano /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule50

{
    $OUT .= load_modules(qw(
                proxy
      proxy_ajp
                proxy_http
                alias
                rewrite
                access
                authz_host
                authz_user
                auth
                auth_anon
            ));
}

expand-template /etc/httpd/conf/httpd.conf
/usr/sbin/apachectl configtest
sv h /service/httpd-e-smith

Copy/Create the worker file (find an exemple):

nano /etc/e-smith/templates-custom/etc/httpd/conf/workers.properties

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

expand-template /etc/httpd/conf/workers.properties
/usr/sbin/apachectl configtest
sv h /service/httpd-e-smith

u must check the tomcat conf/server.xml

Regards,
Xavier
« Last Edit: January 16, 2014, 12:30:51 AM by kid_of_leognan »
“When the wise man points to the moon, the fool looks at the finger.”

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: mod_jk on SME 8
« Reply #4 on: January 16, 2014, 12:22:15 AM »
Xavier,

Those appear to be great instructions... what about to put them at Wiki ?
I can help you... just need an introduction? why to use mod_jk

I have some Tomcat configurated and running on 8080... what mod_jk do better than standard config ? Avoid 8080 port ? Speed up things ? ...

Regards

Jáder
...

Offline Xavier.A

  • ****
  • 104
  • +0/-0
Re: mod_jk on SME 8
« Reply #5 on: January 16, 2014, 12:35:23 AM »
Just security...just security and of course load balancing...and a lot of others features like to use SSL or to let apache serve static web page or to create a virtualhost and to put tomcat on the 127.0.0.1 ip and not  0.0.0.0 ip in the conf/server.xml ;-)

Why connect tomcat to apache would be the good question ?

For the wiki, i don't have so much time and i find no demand for it so....

The complete How-to :
yum install gcc gcc-c++ httpd-devel
cd /usr/local/src
wget http://mir2.ovh.net/ftp.apache.org/dist//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz https://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz.asc https://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.37-src.tar.gz.md5
wget https://www.apache.org/dist/tomcat/tomcat-connectors/KEYS
gpg --import KEYS
gpg --verify tomcat-connectors-1.2.37-src.tar.gz.asc tomcat-connectors-1.2.37-src.tar.gz
cat tomcat-connectors-1.2.37-src.tar.gz.md5 | md5sum -c
tar xvzf tomcat-connectors-1.2.37-src.tar.gz
cd tomcat-connectors-1.2.37-src/native
httpd -v
./configure --with-apxs=/usr/sbin/apxs
make
cp apache-2.0/mod_jk.so /etc/httpd/modules
cd /etc/httpd/modules
ls -al

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/20LoadModule50 /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/
nano /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModule50

{
    $OUT .= load_modules(qw(
                proxy
            proxy_ajp
                proxy_http
                jk
                alias
                rewrite
                access
                authz_host
                authz_user
                auth
                auth_anon
            ));
}

expand-template /etc/httpd/conf/httpd.conf
/usr/sbin/apachectl configtest
sv h /service/httpd-e-smith

cp /usr/local/src/tomcat-connectors-1.2.37-src/conf/workers.properties.minimal /etc/e-smith/templates-custom/etc/httpd/conf/workers.properties
nano /etc/e-smith/templates-custom/etc/httpd/conf/workers.properties

expand-template /etc/httpd/conf/workers.properties
/usr/sbin/apachectl configtest
sv h /service/httpd-e-smith

remove gcc and all devel rpms
yum remove gcc gcc-c++ httpd-devel
But may be, tgminc should look at mod_proxy_ajp, it is the standard module for apache 2.2.x and above ;-)
Regards,
« Last Edit: January 16, 2014, 01:23:35 AM by kid_of_leognan »
“When the wise man points to the moon, the fool looks at the finger.”

Offline tgminc

  • *
  • 15
  • +0/-0
Re: mod_jk on SME 8
« Reply #6 on: January 17, 2014, 12:16:57 AM »
Thanks for the replies.

I did go through it twice; once building from source and then the rpm route (did find that one noted on http://rpm.pbone.net)

In the end I still had issues and still do not know why. I have done this before N-time on SME 7 including multi-host and load balancing.

I may give it another crack in the near future however, to get what I need to up and running I used mod_proxy_ajp. Quite simple actually:

Created custom template fragment: etc/httpd/conf/httpd.conf/20LoadModule80mod_proxy_ajp
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

Created custom template etc/httpd/conf/httpd.conf/fragment35ProxyApps
ProxyPass /artifactory ajp://localhost:8009/artifactory

expand-template /etc/httpd/conf/httpd.conf

/etc/init.d/httpd-e-smith stop

/etc/init.d/httpd-e-smith start

Thanks all.




Offline Xavier.A

  • ****
  • 104
  • +0/-0
Re: mod_jk on SME 8
« Reply #7 on: January 17, 2014, 11:38:38 AM »
The errors seem tu be from a xml files.

Using mod_proxy_ajp is the standard now in production ;-)

“When the wise man points to the moon, the fool looks at the finger.”