<div dir="ltr"><br><div class="gmail_extra">2013/5/25 Francis Daly <span dir="ltr"><<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

On Fri, May 24, 2013 at 02:39:58PM -0300, Sergio Belkin wrote:<br>
<br>
Hi there,<br>
<div class="im"><br>
> I am completeley newbie to nginx<br>
<br>
</div>Welcome.<br>
<br>
The nginx config follows its own logic, which may not match your previous<br>
experiences. When you understand that, you'll have a much better chance<br>
of knowing the configuration you are looking for.<br>
<br></blockquote><div><br></div><div>Yup, I've began to read the documentation :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


One important feature is that one request is handled in one<br>
location. Another is that one http request does not necessarily correspond<br>
to one nginx request.<br>
<br>
In this case...<br>
<br>
you make the request for /demoX, and the best-match location is "location<br>
/demo", and so that is the one that is used.<br>
<div class="im"><br>
>        location /demo {<br>
>            rewrite ^ /upvc;<br>
<br>
</div>Once that happens, you are using the new internal-to-nginx request<br>
"/upvc", so a new choice for best-match location happens, and the rest<br>
of this location{} block is not relevant.<br>
<br>
>            proxy_pass         <a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>;<br>
<br>
>            include    fastcgi_params;<br>
<br>
Aside: the fastcgi_params file will typically have content relevant for<br>
when fastcgi_pass is used, not for when proxy_pass is used.<br>
<br>
So, the http request for /demoX leads to the nginx request for /upvc,<br>
which matches this location:<br>
<div class="im"><br>
> location /upvc {<br>
>         alias  /var/lib/tomcat6/webapps/demo;<br>
>         index demo3.jsp;<br>
>         expires 1m;<br>
<br>
</div>And here, you say "serve it from the filesystem", so that's what it does.<br>
<br>
(I suspect that you actually get a http redirect to /upvc/, which then<br>
returns the content of /var/lib/tomcat6/webapps/demo/demo3.jsp. Using<br>
"curl" as the browser tends to make clear what is happening.)<br></blockquote><div class="im"><br>
> }<br>
<br>
> Rewrite is working but nginx is not.  proxying to tomcat, because of that<br>
> returns the jsp file as a plain text file.<br>
><br>
> Please could you help me?<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The hardest part of nginx config that I find, it working out what exactly<br>
you want to have happen for each request.<br>
<br>
>From the above sample config, I'm not sure what it is that you want.<br></blockquote><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br>
Perhaps putting the proxy_pass in the "location /upvc" block will work? Or<br>
perhaps removing the rewrite?<br></blockquote><div><br><br></div><div>I did it, and tried using curl, tomcat complains that it cannot find /upvc. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br>
If you can describe what behaviour you want, then possibly the nginx<br>
config to achieve it will become clear.<br></blockquote><div><br>I'd want that when you type <a href="http://example.com/upvc">http://example.com/upvc</a> proxies the /var/lib/tomcat6/webapps/demo/<div>demo3.jsp file  to tomcat<br>

<br><br></div>Thanks for your nice explanation<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><font color="#888888"><br>
        f<br>
--<br>
Francis Daly        <a href="mailto:francis@daoine.org">francis@daoine.org</a><br>
</font></span><div class=""><div class="h5"><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--<br>Sergio Belkin  <a href="http://www.sergiobelkin.com" target="_blank">http://www.sergiobelkin.com</a><br>Watch More TV <a href="http://sebelk.blogspot.com" target="_blank">http://sebelk.blogspot.com</a><br>

LPIC-2 Certified - <a href="http://www.lpi.org" target="_blank">http://www.lpi.org</a>
</div></div>