Rewriting and proxy problem
Francis Daly
francis at daoine.org
Mon May 27 19:16:49 UTC 2013
On Mon, May 27, 2013 at 11:31:37AM -0300, Sergio Belkin wrote:
Hi there,
> I'd want that when you type http://example.com/upvc proxies the
> /var/lib/tomcat6/webapps/demo/
> demo3.jsp file to tomcat
Just for clarity, "proxy_pass" proxies to a url, not to a file. So you
probably want it to proxy to http://127.0.0.1:8080/demo/demo3.jsp
If I've got the mapping of url/filename wrong, adjust it as necessary.
You haven't said what any *other* requests to nginx should do, so I will
show an example for only exactly what you said.
There is not an obvious mapping from /upvc to /demo/demo3.jsp, so I
won't include any kind of generic replacement here.
You will find very useful information on all of this at
http://nginx.org/r/proxy_pass
So, in the appropriate server block, you want something like:
location = /upvc {
rewrite ^ /demo/demo3.jsp break;
proxy_pass http://127.0.0.1:8080;
}
This will handle requests for /upvc and /upvc?something. The documentation
should explain why it works.
All of the other directives can be added back, when you know why they
are needed here.
Cheers,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list