Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resin with Apache

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does Resin have to reside on the same machine as Apache? The only docs I can find are setup to install with both on the same machine.
Is running them on 2 seperate machines a bad idea?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I have a question regarding getting Apache to forward requests to Resin.
I have everything set up. Both Apache and Resin are running. I configured the mod_caucho.co and the httpd.conf in apache is loading it.
I have a test.jsp file that is simply:
2 + 2 = <%= 2 + 2 %>
This file resides in /usr/local/apache/htdocs
Now, if I do the following:
http://localhost:8080/test.jsp
Everything works.
However, if I do:
http://localhost/test.jsp
The browser asks me what I want to do with the file, like I want to download it or something.
I changed the resin.conf so that the doc dir points to apache's htdocs folder.
Anything else??
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like an Apache configuration issue to me. Asking for a page from 8080 presumably goes direct to Resin. Have you told Apache to pass all requests for JSP files to Resin?
As an aside, what is Apache giving you that Resin's built-in web server doesn't? Although I have set up systems with Apache and Resin in the past, I've found that for Java and static files, the Resin web server is just as good. Do you need CGI, PHP or something as well?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You make a good point. I just assumed that Apache had a better http server than Resin to service static HTML pages.
However, any J2EE app that has the need for that many static HTML pages to be served probably has its own set of problems.
I probably won't worry about until I need to do it for whatever reason.
Thanks Frank.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the documentation, you cannot run each virtual host in a seperate JVM without Apache. Is there an advantage to having each virtual host run in its own JVM?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
Have you told Apache to pass all requests for JSP files to Resin?

I thought that Loading the caucho module took care of that. However, I compiled apache to allow module support, and when I try and do the AddModule after the LoadModule, I get an error in the httpd.conf file that implies that I don't have module support.
So who knows.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an advantage to having each virtual host run in its own JVM?
Yes, if each virtual host is "owned" by a different customer. I used to do this so that I could allow users to restart a VM if something went wrong, without breaking everyone else's applications!
 
Daniel Bjuhr
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, if each virtual host is "owned" by a different customer. I used to do this so that I could allow users to restart a VM if something went wrong, without breaking everyone else's applications!
This is exactly my problem. I used Resin as standalone server without Apache, resulting in that each time a new customer arrived I had to edit "resin.conf". That resulted in that all current applications went down and where logged out.
I have now tryed to run Resin with multiple JVM:s together with Apache that takes care of the virtual hosts. I can now start and stop each application in Resin separatley and also start new applications in Resin without interrupting the other applications.
After adding a new webbapplication in Resin I adds a virtual host in Apache and restarts it.
This seems to work, but gets very unstable. I wonder if it has to do with the communication between Apache and Resin?
Sometimes I get the proper response from a webapplication and other times I gets the jsp code as response. The jsp code probably comes directly from Apache that maybe doesn't gets contact with Resin all times?
Does anyone know how to set up this correctly???
I have used Resin 3.0.4 and Apache 2.0.48.
This is my conf files:
I start a webapplication with following command:
/home/resin/bin/httpd.sh -conf /home/resin/conf/www.mydomain.com.conf -pid /home/resin/conf/www.mydomain.com.pid start

This is how the conf file for the webapp in Resin looks like:
<resin xmlns="http://caucho.com/ns/resin">
<resin:include href="common.conf"/>
<cluster>
<srun id="" host="127.0.0.1" port="6802" index="1"/>
</cluster>
<host id='www.mydomain.com'>
<web-app id='' document-directory='/home/myapps/mydomain'/>
</host>
</server>
</resin>

This is how the mapping in Apache looks like:
LoadModule caucho_module /usr/local/apache2/modules/mod_caucho.so
<IfModule mod_caucho.c>
ResinConfigServer localhost 6802
<Location /caucho-status>
SetHandler caucho-status
</Location>
</IfModule>
NameVirtualHost 192.168.0.1
<VirtualHost 192.168.0.1>
ServerName www.mydomain.com
ResinConfigServer 192.168.0.1 6802
DirectoryIndex index.jsp
DocumentRoot /home/myapps/mydomain
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic