• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

How to get to web root when tomcat is stopped?

Hello,

I currently have Apache and Tomcat running. I have a rewrite rule in Apache that rewrites all requests to point to tomcat:

RewriteRule ^//data/(.*) /cps/rde/xbcr/blah/$1 [PT]

RewriteRule ^//papp/(.*) /cps/rde/papp/$1 [PT]

RewriteRule ^/$ /cps/rde/xchg/blah/ [PT]

RewriteRule ^//$ /cps/rde/xchg/blah/ [PT]

RewriteRule ^//(.*) /cps/rde/xchg/blah/hs/$1 [PT]


If I stop tomcat I get this page:

"The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@blah.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log."


I would like requests to the server to be redirected automatically to the Apache document root IF Tomcat is stopped.

Any ideas on how to accomplish this?

Thanks,

BB
0
baxleyb
Asked:
baxleyb
  • 2
1 Solution
 
NopiusCommented:
Apply rules only when pidfile of Tomcat exists (suppose it's a /var/run/jsvc.pid), then:

RewriteCond /var/run/jsvc.pid -f
RewriteRule ^//data/(.*) /cps/rde/xbcr/blah/$1 [PT]
RewriteCond /var/run/jsvc.pid -f
RewriteRule ^//papp/(.*) /cps/rde/papp/$1 [PT]
RewriteCond /var/run/jsvc.pid -f
RewriteRule ^/$ /cps/rde/xchg/blah/ [PT]
RewriteCond /var/run/jsvc.pid -f
RewriteRule ^//$ /cps/rde/xchg/blah/ [PT]
RewriteCond /var/run/jsvc.pid -f
RewriteRule ^//(.*) /cps/rde/xchg/blah/hs/$1 [PT]

0
 
baxleybAuthor Commented:
Nopius,

Wow that sounds cool, I'll try that, so how can I find out the pidfile for tomcat?

Thanks again.

-BB
0
 
NopiusCommented:
Start tomcat, look into /var/run then stop tomcat and look there again. Probably /var/run/jsvc.pid is a pidfile of tomcat.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now