I'm running Tomcat with Nginx as a load balancer. And too keep all the redirects etc consistent, I am also running it in front of Eclipse.
Tomcat in Eclipse seems to fail it you try to configure multiple virtual hosts. So I need to configure each app to run from a different url in Eclipse. e.g. the server.xml
looks like:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Context docBase="app1" path="/" reloadable="true" source="org.eclipse.jst.jee.server:app1"/>
<Context docBase="app2" path="/app2" reloadable="true" source="org.eclipse.jst.jee.server:app2"/>
</Host>
Problem is when I proxy to it, I can't get it to use the code in the subfolder app2
. It serves it from the root. And I can't seem to get a rewrite to fix it either...
Nginx config has...
location ~ \.(do|jsp)$ {
#rewrite ^(.*) $1 break;
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
What I want to do is:
proxy_pass http://127.0.0.1:8080/app2;
But that's not allowed it seems.
I know how to fig it with a server. But Eclipse seems to only work with a single virtual host. So I'm stuck with folders...
What am I missing?