On Fri, 2009-06-26 at 08:59 -0500, Dimitrios Christodoulakis wrote:
> Hello,
> 
> I have been struggling for the past couple of weeks to redirect
> external traffic from the Apache 2 server to Tomcat 5.5 on a godaddy
> dedicated server.
> 
> We have created a new domain on the server, which default public path
> is /home/myadmin/public_html/ when someone points there browser to
> www.mydomain.com
> 
> At the same time I have uploaded and deployed the application under
> usr/java/tomcat-5.5/webapps/mydomain/
> 
> As I understand at this time web content is served by the apache
> server and not Tomcat. What I have been trying to do is to have all
> pages static and dynamic be served by Tomcat.
> 
> Godaddy offers limited support unless we buy into their assisted
> service plan. I followed some steps they initially suggested which
> involved creating a symbolic link between the default public directory
> /home/myadmin/public_html/ and the application directory
> usr/java/tomcat-5.5/webapps/mydomain/ by using the command:
> 
> ln -s /usr/java/tomcat-5.5/webapps/mydomain/index.html
> /home/myadmin/public_html
> 
> With this I hoped all requests from www.mydomain.com going to
> /home/myadmin/public_html would be automatically redirected to the
> actual tomcat content starting with the deployed application's
> index.html page. But unfortunately this does not work. I am always
> returned the 404 error message.
> 
> Is there a known or recommended way to resolve this issue? After some
> searching I believe there are workarounds involving editing the
> /usr/java/tomcat-5.5/conf/server.xml and the etc/httpd/conf/http.conf
> files. Would it be possible someone to provide some general steps how
> to do this?
> 
> Many thanks for any practical help.
> 


Well this is how I do it, your mileage will vary.

I use mod_proxy_http with tomcat configured for just a http connector.
T
I setup a mod_proxy.conf file for the apache and I'll just show how I do
it for the tomcat examples.  Apache serves the statis html & images, the
jsp/servlets are fed by tomcat.

__BEGIN__
<IfModule mod_proxy.c>
  #######################################################################
  # MOD_PROXY CONFIGURATIONS                                            # 
  #######################################################################
  LoadModule proxy_http_module modules/mod_proxy_http.so

  ProxyRequests Off

  # Make sure that the virtual host name is passed through to the
  # backend servlet container for virtual host support.
  ProxyPreserveHost On

  # Tell mod_mod proxy that it should not send back the body-content of
  # error pages, but be fascist and use its local error pages if the
  # remote HTTP stack is sending an HTTP 4xx or 5xx status code.
  ProxyErrorOverride On
  ProxyPassReverse / http://localhost:8080/

  <Proxy *>
       Order deny,allow
       Allow from all
  </Proxy>

  RewriteLog logs/rewrite_log
  RewriteLogLevel 1

  Alias /examples "/opt/webBaseDir/webapps/examples"

  <LocationMatch "/examples">
     <LimitExcept POST GET PUT>
        Order Deny,Allow
        Deny from all
        Allow from none
     </LimitExcept>
     # The nastiness begins, let's fire up the "rewrite engine"
     RewriteEngine On
     # Everything ending in ".gif", ".jpg" or ".jpeg" will be served again
     # directly by Apache, no need to bother the servlet container. As above
     # this is the last rule as specified by the [L] flag at the end
     RewriteRule \.(pl|php|cgi)$ - [PT,L]
     RewriteRule \.(jpg|jpeg|gif|png|html)$ - [PT,L]

     # Everything that starts with a NON-CASE-SENSITIVE match (the NC flag)
     # of "/WEB-INF" or "/WEB-INF/" is forbidden (the F flag). And again,
     # this is the last rule (the L flag), nothing will be processed by the
     # rewrite engine if this rule is matched
     RewriteRule "^.*/WEB-INF/?(.*)" - [L,F,NC]

     # Any jsp, jspx, do, servlet get proxied
     RewriteRule \.(jsp|jspx|do) "http://localhost:8080%{REQUEST_URI}"; [P,L]
     RewriteRule "^/(.*)/servlet/(.*)" "http://localhost:8080%{REQUEST_URI}"; 
[P,L]
  </LocationMatch>

</IfModule>

__END__


-- 
Brian Millett - [ Sinclair, Zathras, and Garibaldi, "Babylon Squared"]
S: "Why do you need Babylon 5?"
Z: "Zathras tell, you let Zathras go? Finish what Zathras came for?"
G: "Zathras tells maybe we don't break Zathras scrawny little neck."

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to