<div dir="ltr"><div style>Also i tried adding the address to the try_files:</div><div style><br></div><div style>try_files $uri $uri @app/de/; and try_files $uri $uri @app/de;<br></div><div style><br></div><div style>but that didn't work either.</div>
<div><br></div><div style>The way i managed to provide translated content, was using a rewrite inside of my location block: rewrite ^(.*)$ /my-language/$1 break;</div><div><br></div><div style>That solves part of my problem.<br>
</div><div style><br></div><div style><br></div><div style><br></div><div style>The core basic of my problem is "Rewrite the URL based on the "server name"".</div><div style><br></div><div style>So far the only options i see on nginx are:</div>
<div style><br></div><div style>1. Have a configuration with one "if" and one "rewrite" in order to map server name to path</div><div style><br></div><div style>2. Multiple server declarations sharing the same configuration ( probably using some sort of include? )</div>
<div style><br></div><div style><br></div><div style>What you reckon? Any suggestion ?</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 5 May 2013 02:21, henrique matias <span dir="ltr"><<a href="mailto:hems.inlet@gmail.com" target="_blank">hems.inlet@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My first try was to change my location / { } to proxy pass to another language, so i could try "the backend" as you said, but it actually didn't work, i got:<div>
<br></div><div>[emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/nginx.conf:79</div>
<div><br></div><div>my nginx version is 1.3.15.</div><div><br></div><div>will keep trying, if someone knows how to work this around, would be cool, i guess this happens quite often :P</div><div><br></div><div>
[s]</div><div><div class="h5"><div><br></div><div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 4 May 2013 22:48, Francis Daly <span dir="ltr"><<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Mon, Apr 29, 2013 at 10:02:35PM +0100, henrique matias wrote:<br>
<br>
Hi there,<br>
<div><br>
> Am having trouble setting up my nginx.config to transparently proxy the<br>
> subdomains and domains to the same app, but with different "path<br>
> components" appended to the $uri<br>
<br>
</div>Frequently, the main problem is that the back-end application makes it<br>
very hard to do this.<br>
<br>
I suggest you test first using a separate server{} block for one<br>
server_name and demonstrate to yourself that it can work.<br>
<br>
After that, you can worry about the details of how to auto-handle the<br>
extra domains.<br>
<br>
Something like (untested):<br>
<br>
server {<br>
server_name <a href="http://www.mydomain.it" target="_blank">www.mydomain.it</a>;<br>
location / {<br>
proxy_pass <a href="http://app_server/it/" target="_blank">http://app_server/it/</a>;<br>
}<br>
}<br>
<br>
maybe with "proxy_set_header Host <a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a>;", or whatever your<br>
application needs.<br>
<br>
The important things to check are, do links in the returned content work<br>
when the browser asks for "/dir/" but the app_server gets a request for<br>
"/it/dir/"?<br>
<br>
The above is *almost* the same as what you have here:<br>
<div><br>
> This is my last unsuccessful attempt: <a href="http://pastebin.com/bZZA30zC" target="_blank">http://pastebin.com/bZZA30zC</a><br>
<br>
</div>but there's an extra "/" in the proxy_pass line; and as you've not said<br>
in what way yours was unsuccessful, it's hard to suggest a specific fix.<br>
<br>
Compare the output of "curl -i <a href="http://www.mydomain.com/it/SOMETHING" target="_blank">http://www.mydomain.com/it/SOMETHING</a>"<br>
with the output of "curl -i <a href="http://www.mydomain.it/SOMETHING" target="_blank">http://www.mydomain.it/SOMETHING</a>", and with<br>
what you expect the output to be.<br>
<span><font color="#888888"><br>
f<br>
--<br>
Francis Daly <a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">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>
</font></span></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div>