2013/5/27 Sergio Belkin <[email protected]> > > 2013/5/25 Francis Daly <[email protected]> > >> On Fri, May 24, 2013 at 02:39:58PM -0300, Sergio Belkin wrote: >> >> Hi there, >> >> > I am completeley newbie to nginx >> >> Welcome. >> >> The nginx config follows its own logic, which may not match your previous >> experiences. When you understand that, you'll have a much better chance >> of knowing the configuration you are looking for. >> >> > Yup, I've began to read the documentation :) > > >> One important feature is that one request is handled in one >> location. Another is that one http request does not necessarily correspond >> to one nginx request. >> >> In this case... >> >> you make the request for /demoX, and the best-match location is "location >> /demo", and so that is the one that is used. >> >> > location /demo { >> > rewrite ^ /upvc; >> >> Once that happens, you are using the new internal-to-nginx request >> "/upvc", so a new choice for best-match location happens, and the rest >> of this location{} block is not relevant. >> >> > proxy_pass http://127.0.0.1:8080; >> >> > include fastcgi_params; >> >> Aside: the fastcgi_params file will typically have content relevant for >> when fastcgi_pass is used, not for when proxy_pass is used. >> >> So, the http request for /demoX leads to the nginx request for /upvc, >> which matches this location: >> >> > location /upvc { >> > alias /var/lib/tomcat6/webapps/demo; >> > index demo3.jsp; >> > expires 1m; >> >> And here, you say "serve it from the filesystem", so that's what it does. >> >> (I suspect that you actually get a http redirect to /upvc/, which then >> returns the content of /var/lib/tomcat6/webapps/demo/demo3.jsp. Using >> "curl" as the browser tends to make clear what is happening.) >> > > > } > > > Rewrite is working but nginx is not. proxying to tomcat, because of that > > returns the jsp file as a plain text file. > > > > Please could you help me? > > The hardest part of nginx config that I find, it working out what exactly >> you want to have happen for each request. >> >> From the above sample config, I'm not sure what it is that you want. >> > > > > >> >> Perhaps putting the proxy_pass in the "location /upvc" block will work? Or >> perhaps removing the rewrite? >> > > > I did it, and tried using curl, tomcat complains that it cannot find > /upvc. > > >> >> If you can describe what behaviour you want, then possibly the nginx >> config to achieve it will become clear. >> > > I'd want that when you type http://example.com/upvc proxies the > /var/lib/tomcat6/webapps/demo/ > demo3.jsp file to tomcat > > > Thanks for your nice explanation > > >> >> f >> -- >> Francis Daly [email protected] >> >> _______________________________________________ >> nginx mailing list >> [email protected] >> http://mailman.nginx.org/mailman/listinfo/nginx >> > > > > -- > -- >
Anyway it's obvious that results in "not found" tomcat upvc directory does not exist,. Shame on me :'-( -- -- Sergio Belkin http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com LPIC-2 Certified - http://www.lpi.org
_______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
