You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Olivier Nicole <Ol...@cs.ait.ac.th> on 2014/12/15 08:13:23 UTC

Tomcat 8 + mod_jk + apache 2.2x on FreeBSD

Hi,

I am completely new to Tomcat and/or java, but I have been assigned the
task to get it running.

Right now, tomcat is running on port 8090 and I can access the pages in
a satisfactory way.

I am also running what I expect to be the ajp13 connector with: 
    <Connector port="8009" protocol="AJP/1.3" 
	       enableLookups="false" 
	       redirectPort="8443" />
and I can see that the port 8009 is listening.

Now I would like to have Tomcat behind my Apache (2.2.27) server.

I setup a worker.properties file that is like:

workers.tomcat_home=/usr/local/apache-tomcat-8.0
workers.java_home=/usr/local/openjdk7
ps=/
worker.list=localhost-worker
worker.localhost-worker.port=8009
worker.localhost-worker.host=localhost
worker.localhost-worker.type=ajp13
worker.localhost-worker.lbfactor=1

and in httpd.conf I have:

LoadModule jk_module          libexec/apache22/mod_jk.so
<IfModule mod_jk.c>
	JkWorkersFile /usr/local/etc/apache22/workers.properties
	JkLogFile  /var/log/jk.log
	JkShmFile  /var/run/httpd/mod_jk.shm
	JkLogLevel info
 	JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
 	JkRequestLogFormat     "%w %V %T"

	# Sample JkMounts.  Replace these with the paths you would
	# like to mount from your JSP server.
	#JkMount /*.jsp jsp-hostname
	#JkMount /servlet/* jsp-hostname
	#JkMount /examples/* jsp-hostname
</IfModule>

And the proper JkMount

I see that Apache is connecting to tomcat on port 8009, but I cannot get
much information from the tcpdump trace.

I have no idea where to look for log file (beside the
tomcat-home/logs/catalina.out that I don't understand

I have been looking at many how-to, but all of them are incomplete,
outdated, and refeer to tens of things that I don't understand either.

Is there an comprehensive how-to interface Apache to Tomcat? Something
with example I can simply copy to make it work?

I am using FreeBSD 9.2

Thanks in advance,

Olivier

-- 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8 + mod_jk + apache 2.2x on FreeBSD

Posted by Mark Thomas <ma...@apache.org>.
On 15/12/2014 08:37, Aurélien Terrestris wrote:
>> I get Tomcat default home page, but images and CSS are not loaded:
> 
> All resources are not available and all links are broken. This happens
> because you're proxyfying to /dspace but Tomcat "ROOT" webapp is
> written for the "/" context

Changing the path in the reverse proxy is one of the easiest ways to
create a whole bunch of hassle for yourself. You really want to avoid
that if at all possible.

Mark


> 
> http://www.cs.ait.ac.th/dspace/docs/manager-howto.html then works correctly
> 
> Maybe, try renaming  the ROOT folder (tomcat/webapps/ROOT) to dspace,
> and update your proxypass to
> 
> ProxyPass /dspace ajp://localhost:8809/dspace
> ProxyPassReverse /dspace ajp://localhost:8809/dspace
> 
> 
> If renaming the folder, the ROOT.war will recreate it.. maybe
> necessary to rename it also.
> 
> 
> regards
> 
> 2014-12-15 9:16 GMT+01:00 Olivier Nicole <Ol...@cs.ait.ac.th>:
>> Aurélien,
>>
>>> if Apache and Tomcat are running on the same machine, the tcpdump
>>> won't capture the trafic because the proxy requests are using the
>>> loopback interface and not the ethernet port.
>>
>> tcpdump -i lo0 ;)
>>
>>> Instead of using the "workers" properties and the mod-jk section, you
>>> could try with the ProxyPass syntax (easier, faster for your need)
>>>
>>>
>>> LoadModule proxy_module modules/mod_proxy.so
>>> LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
>>>
>>>     ProxyPass /         ajp://localhost:8009/
>>>     ProxyPassReverse /  ajp://localhost:8009/
>>
>> That work, I get Tomcat default home page, but images and CSS are not
>> loaded: see http://www.cs.ait.ac.th/dspace
>>
>> Thank you,
>>
>> Olivier
>>
>>
>>> Then, try a ' netstat -an ' to see the ESTABLISHED, it should look
>>> like this with at least one ESTABLISHED line
>>>
>>> tcp        0      0 :::8009                     :::*
>>>      LISTEN
>>> tcp        0      0 ::ffff:127.0.0.1:8009       ::ffff:127.0.0.1:39908
>>>      ESTABLISHED
>>>
>>>
>>> regards
>>>
>>> 2014-12-15 8:13 GMT+01:00 Olivier Nicole <Ol...@cs.ait.ac.th>:
>>>> Hi,
>>>>
>>>> I am completely new to Tomcat and/or java, but I have been assigned the
>>>> task to get it running.
>>>>
>>>> Right now, tomcat is running on port 8090 and I can access the pages in
>>>> a satisfactory way.
>>>>
>>>> I am also running what I expect to be the ajp13 connector with:
>>>>     <Connector port="8009" protocol="AJP/1.3"
>>>>                enableLookups="false"
>>>>                redirectPort="8443" />
>>>> and I can see that the port 8009 is listening.
>>>>
>>>> Now I would like to have Tomcat behind my Apache (2.2.27) server.
>>>>
>>>> I setup a worker.properties file that is like:
>>>>
>>>> workers.tomcat_home=/usr/local/apache-tomcat-8.0
>>>> workers.java_home=/usr/local/openjdk7
>>>> ps=/
>>>> worker.list=localhost-worker
>>>> worker.localhost-worker.port=8009
>>>> worker.localhost-worker.host=localhost
>>>> worker.localhost-worker.type=ajp13
>>>> worker.localhost-worker.lbfactor=1
>>>>
>>>> and in httpd.conf I have:
>>>>
>>>> LoadModule jk_module          libexec/apache22/mod_jk.so
>>>> <IfModule mod_jk.c>
>>>>         JkWorkersFile /usr/local/etc/apache22/workers.properties
>>>>         JkLogFile  /var/log/jk.log
>>>>         JkShmFile  /var/run/httpd/mod_jk.shm
>>>>         JkLogLevel info
>>>>         JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>>>>         JkRequestLogFormat     "%w %V %T"
>>>>
>>>>         # Sample JkMounts.  Replace these with the paths you would
>>>>         # like to mount from your JSP server.
>>>>         #JkMount /*.jsp jsp-hostname
>>>>         #JkMount /servlet/* jsp-hostname
>>>>         #JkMount /examples/* jsp-hostname
>>>> </IfModule>
>>>>
>>>> And the proper JkMount
>>>>
>>>> I see that Apache is connecting to tomcat on port 8009, but I cannot get
>>>> much information from the tcpdump trace.
>>>>
>>>> I have no idea where to look for log file (beside the
>>>> tomcat-home/logs/catalina.out that I don't understand
>>>>
>>>> I have been looking at many how-to, but all of them are incomplete,
>>>> outdated, and refeer to tens of things that I don't understand either.
>>>>
>>>> Is there an comprehensive how-to interface Apache to Tomcat? Something
>>>> with example I can simply copy to make it work?
>>>>
>>>> I am using FreeBSD 9.2
>>>>
>>>> Thanks in advance,
>>>>
>>>> Olivier
>>>>
>>>> --
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>> --
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8 + mod_jk + apache 2.2x on FreeBSD

Posted by Aurélien Terrestris <at...@gmail.com>.
>I get Tomcat default home page, but images and CSS are not loaded:

All resources are not available and all links are broken. This happens
because you're proxyfying to /dspace but Tomcat "ROOT" webapp is
written for the "/" context

http://www.cs.ait.ac.th/dspace/docs/manager-howto.html then works correctly

Maybe, try renaming  the ROOT folder (tomcat/webapps/ROOT) to dspace,
and update your proxypass to

ProxyPass /dspace ajp://localhost:8809/dspace
ProxyPassReverse /dspace ajp://localhost:8809/dspace


If renaming the folder, the ROOT.war will recreate it.. maybe
necessary to rename it also.


regards

2014-12-15 9:16 GMT+01:00 Olivier Nicole <Ol...@cs.ait.ac.th>:
> Aurélien,
>
>> if Apache and Tomcat are running on the same machine, the tcpdump
>> won't capture the trafic because the proxy requests are using the
>> loopback interface and not the ethernet port.
>
> tcpdump -i lo0 ;)
>
>> Instead of using the "workers" properties and the mod-jk section, you
>> could try with the ProxyPass syntax (easier, faster for your need)
>>
>>
>> LoadModule proxy_module modules/mod_proxy.so
>> LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
>>
>>     ProxyPass /         ajp://localhost:8009/
>>     ProxyPassReverse /  ajp://localhost:8009/
>
> That work, I get Tomcat default home page, but images and CSS are not
> loaded: see http://www.cs.ait.ac.th/dspace
>
> Thank you,
>
> Olivier
>
>
>> Then, try a ' netstat -an ' to see the ESTABLISHED, it should look
>> like this with at least one ESTABLISHED line
>>
>> tcp        0      0 :::8009                     :::*
>>      LISTEN
>> tcp        0      0 ::ffff:127.0.0.1:8009       ::ffff:127.0.0.1:39908
>>      ESTABLISHED
>>
>>
>> regards
>>
>> 2014-12-15 8:13 GMT+01:00 Olivier Nicole <Ol...@cs.ait.ac.th>:
>>> Hi,
>>>
>>> I am completely new to Tomcat and/or java, but I have been assigned the
>>> task to get it running.
>>>
>>> Right now, tomcat is running on port 8090 and I can access the pages in
>>> a satisfactory way.
>>>
>>> I am also running what I expect to be the ajp13 connector with:
>>>     <Connector port="8009" protocol="AJP/1.3"
>>>                enableLookups="false"
>>>                redirectPort="8443" />
>>> and I can see that the port 8009 is listening.
>>>
>>> Now I would like to have Tomcat behind my Apache (2.2.27) server.
>>>
>>> I setup a worker.properties file that is like:
>>>
>>> workers.tomcat_home=/usr/local/apache-tomcat-8.0
>>> workers.java_home=/usr/local/openjdk7
>>> ps=/
>>> worker.list=localhost-worker
>>> worker.localhost-worker.port=8009
>>> worker.localhost-worker.host=localhost
>>> worker.localhost-worker.type=ajp13
>>> worker.localhost-worker.lbfactor=1
>>>
>>> and in httpd.conf I have:
>>>
>>> LoadModule jk_module          libexec/apache22/mod_jk.so
>>> <IfModule mod_jk.c>
>>>         JkWorkersFile /usr/local/etc/apache22/workers.properties
>>>         JkLogFile  /var/log/jk.log
>>>         JkShmFile  /var/run/httpd/mod_jk.shm
>>>         JkLogLevel info
>>>         JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>>>         JkRequestLogFormat     "%w %V %T"
>>>
>>>         # Sample JkMounts.  Replace these with the paths you would
>>>         # like to mount from your JSP server.
>>>         #JkMount /*.jsp jsp-hostname
>>>         #JkMount /servlet/* jsp-hostname
>>>         #JkMount /examples/* jsp-hostname
>>> </IfModule>
>>>
>>> And the proper JkMount
>>>
>>> I see that Apache is connecting to tomcat on port 8009, but I cannot get
>>> much information from the tcpdump trace.
>>>
>>> I have no idea where to look for log file (beside the
>>> tomcat-home/logs/catalina.out that I don't understand
>>>
>>> I have been looking at many how-to, but all of them are incomplete,
>>> outdated, and refeer to tens of things that I don't understand either.
>>>
>>> Is there an comprehensive how-to interface Apache to Tomcat? Something
>>> with example I can simply copy to make it work?
>>>
>>> I am using FreeBSD 9.2
>>>
>>> Thanks in advance,
>>>
>>> Olivier
>>>
>>> --
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8 + mod_jk + apache 2.2x on FreeBSD

Posted by Aurélien Terrestris <at...@gmail.com>.
Olivier,

if Apache and Tomcat are running on the same machine, the tcpdump
won't capture the trafic because the proxy requests are using the
loopback interface and not the ethernet port.

Instead of using the "workers" properties and the mod-jk section, you
could try with the ProxyPass syntax (easier, faster for your need)


LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

    ProxyPass /         ajp://localhost:8009/
    ProxyPassReverse /  ajp://localhost:8009/

Then, try a ' netstat -an ' to see the ESTABLISHED, it should look
like this with at least one ESTABLISHED line

tcp        0      0 :::8009                     :::*
     LISTEN
tcp        0      0 ::ffff:127.0.0.1:8009       ::ffff:127.0.0.1:39908
     ESTABLISHED


regards

2014-12-15 8:13 GMT+01:00 Olivier Nicole <Ol...@cs.ait.ac.th>:
> Hi,
>
> I am completely new to Tomcat and/or java, but I have been assigned the
> task to get it running.
>
> Right now, tomcat is running on port 8090 and I can access the pages in
> a satisfactory way.
>
> I am also running what I expect to be the ajp13 connector with:
>     <Connector port="8009" protocol="AJP/1.3"
>                enableLookups="false"
>                redirectPort="8443" />
> and I can see that the port 8009 is listening.
>
> Now I would like to have Tomcat behind my Apache (2.2.27) server.
>
> I setup a worker.properties file that is like:
>
> workers.tomcat_home=/usr/local/apache-tomcat-8.0
> workers.java_home=/usr/local/openjdk7
> ps=/
> worker.list=localhost-worker
> worker.localhost-worker.port=8009
> worker.localhost-worker.host=localhost
> worker.localhost-worker.type=ajp13
> worker.localhost-worker.lbfactor=1
>
> and in httpd.conf I have:
>
> LoadModule jk_module          libexec/apache22/mod_jk.so
> <IfModule mod_jk.c>
>         JkWorkersFile /usr/local/etc/apache22/workers.properties
>         JkLogFile  /var/log/jk.log
>         JkShmFile  /var/run/httpd/mod_jk.shm
>         JkLogLevel info
>         JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>         JkRequestLogFormat     "%w %V %T"
>
>         # Sample JkMounts.  Replace these with the paths you would
>         # like to mount from your JSP server.
>         #JkMount /*.jsp jsp-hostname
>         #JkMount /servlet/* jsp-hostname
>         #JkMount /examples/* jsp-hostname
> </IfModule>
>
> And the proper JkMount
>
> I see that Apache is connecting to tomcat on port 8009, but I cannot get
> much information from the tcpdump trace.
>
> I have no idea where to look for log file (beside the
> tomcat-home/logs/catalina.out that I don't understand
>
> I have been looking at many how-to, but all of them are incomplete,
> outdated, and refeer to tens of things that I don't understand either.
>
> Is there an comprehensive how-to interface Apache to Tomcat? Something
> with example I can simply copy to make it work?
>
> I am using FreeBSD 9.2
>
> Thanks in advance,
>
> Olivier
>
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org