Solved

share resources for web and application server

Posted on 2008-10-08
3
146 Views
Last Modified: 2012-05-05
Hi gurus,

Here I got a problem to solve. There are two domains on my web server (e.g. domain S and domain W). Domain S will use the JSPs on application server.

Let's assumed I have a new form placed on application server and I wanna make use of those images and stylesheets on web server.

Is there any way I can configure in my apache and tomcat, so that I can do the followings?

e.g.
Types                  Availability
html                  Domain W
jsp                  Domain S

jpeg                  Domain W & Domain S
css                  Domain W & Domain S
js                  Domain W & Domain S


If so, what files I have to configure? I knew there are some XMLs but i am not too sure.

Thanks for your help.
0
Comment
Question by:manfredino
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
urgoll earned 125 total points
ID: 22675606
Greetings,
With their default configuration, apache will listen on port 80 and Tomcat on port 8080. Casual web users will access port 80, as that's the standard port for web traffic.

The usual way to handle you situation is to setup two virtualhosts on your apache server, one for each domain, and to tell apache to proxy requests to your JSP files to your tomcat server.

See snippet below for sample config. What this does is setup your apache server to answer requests for both domains and server static files from /var/www/html/domain-s or /var/www/html/domain-w depending on the domain being accessed. Additionaly, any request path that starts with /jsp to domain S will be forward to the tomcat server transparently to the user.

If this does not meet your needs, please let me know and I'll address your concerns.

Regards,
Christophe
NameVirtualHost *:80
 
<VirtualHost *:80>
    ServerAdmin webmaster@domain-w.com
    DocumentRoot /var/www/html/domain-w
    ServerName www.domain-w.com
    ErrorLog /var/log/httpd/www.domain-w.com-error_log
    CustomLog /var/log/httpd/www.domain-w.com-access_log combined
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@domain-s.com
    DocumentRoot /var/www/html/domain-s
    ServerName www.domain-s.com
    ErrorLog /var/log/httpd/www.domain-s.com-error_log
    CustomLog /var/log/httpd/www.domain-s.com-access_log combined
    ProxyPass /jsp http://localhost:8080/jsp
    ProxyPassReverse /jsp http://localhost:8080/jsp
</VirtualHost>

Open in new window

0
 

Author Comment

by:manfredino
ID: 22699718
Hi Christophe,

Thanks for your information, it helps me a lot!

As there are several XML files for Apache and Tomcat, they look quite similar but I am wondering if I have to modify all those serverl.xml / web.xml.

Thanks for your help again.

Cheers,
Manfred
0
 

Author Comment

by:manfredino
ID: 22700096
Assume here's my case.
1.      s-stuff https://s-stuff.MySite.com (secured stuff with JSP from application server)
2.      www      http:/www.MySite.com (mainly static stuff like html and images, etc)


If I'm browsing a page through https (e.g. https://s-stuff.MySite.com/abc.jsp) and there are some images for navigation menu.

Would these images derived from https://www.MySite.com/images/menu1.gif or http://www.MySite.com/images/menu1.gif? 
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question