Domanda

I have a server running apache2 that is currently serving several apps on a tomcat6 instance. Those are already configured and working and there is a rewrite rule, like this:

RewriteCond %{REQUEST_URI} ^/app1 [NC,OR]
RewriteCond %{REQUEST_URI} ^/app2 [NC,OR]
RewriteCond %{REQUEST_URI} ^/app3 [NC,OR]
RewriteCond %{REQUEST_URI} ^/aap4 [NC,OR]
RewriteCond %{REQUEST_URI} ^/app5 [NC,OR]
RewriteCond %{REQUEST_URI} ^/app6 [NC]
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R,L]

then it has the JKMounts:

JkMount /app1/*.jsp tomcat.web
JkMount /app2* tomcat.web
JkMount /app3* tomcat.web
JkMount /app6* tomcat.web
JkMount /app6* tomcat.web
JkMount /app6* tomcat.web

And the workers.properties looks like this:

workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=\

worker.list=tomcat.web

# Set properties for worker 'tomcat.web' (ajp13)
worker.tomcat.web.type=ajp13
worker.tomcat.web.host=localhost
worker.tomcat.web.port=8009
worker.tomcat.web.cachesize=10
worker.tomcat.web.cache_timeout=600
worker.tomcat.web.socket_keepalive=1
worker.tomcat.web.connection_pool_size=150
worker.tomcat.web.connection_pool_minsize=75
worker.tomcat.web.connection_pool_timeout=10000

I had added a new tomcat installation and there I have running a new app, called 'online'. So I added a new worker, like this (also appended the worker name into worker.list):

# Set properties for worker 'tomcatb.web' (ajp13)
worker.tomcatb.web.type=ajp13
worker.tomcatb.web.host=localhost
worker.tomcatb.web.port=8109
worker.tomcatb.web.cachesize=10
worker.tomcatb.web.cache_timeout=600
worker.tomcatb.web.socket_keepalive=1
worker.tomcatb.web.connection_pool_size=150
worker.tomcatb.web.connection_pool_minsize=75
worker.tomcatb.web.connection_pool_timeout=10000

and then I just added a new COND on top of all other CONDs

RewriteCond %{REQUEST_URI} ^/online [NC,OR]

and a new JKMount like this:

JkMount /online* tomcatb.web

Here things work fine. I can access my app in

http://MYSERVER/online

and it works ok. Now I need to be able to serve that app just by accesing

http://MYSERVER/

but I have not been able to accomplish that. I've been trying to write a rewrite rule like this (removing the previous COND, and adding this):

RewriteCond %{REQUEST_URI} ^/online [NC,OR]
RewriteCond %{SERVER_PORT} !443
RewriteRule ^online(.*)$ / [PT,QSA,L]

but that doesn't work, and when I go to

http://MYSERVER/

I get the error:

Forbidden
You don't have permission to access / on this server.

Can someone point me in the right direction on how to configure apache to server my app the way I need it?

È stato utile?

Soluzione

I solved this, not sure if I did it using the best approach, but this I what I did in the end (which accomplish my requirement, so by now it's good enough)

I added a new rewrite condition, like this:

RewriteCond %{REQUEST_URI} ^/ [NC,OR]

Then this JKMount

JkMount /* tomcatb.web

And since the app I need to server run in a separate tomcat instance, I removed all webapps and deployed the war as ROOT.war.

Restart everything and now if I go to

http://MYSERVER/

it displays the content that I am expecting

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top