<div dir="ltr">Hello Francis, thanks a lot for your help and words.<div><br></div><div>Sorry if at some point i didn't make something clear.</div><div><br></div><div><br></div><div><br></div><div>
Starting from scratch,</div><div><br></div><div>1. My backend already works, <a href="http://my_ip/#%7Blanguage_code%7D/anything" target="_blank">http://my_ip/#{language_code}/anything</a> will bring "anything" translated to the specified language.</div>


<div><br></div><div>2. Changing the line 40 on my config: <a href="http://pastebin.com/bZZA30zC" target="_blank">http://pastebin.com/bZZA30zC</a> from</div><div><span style="line-height:21px;font-size:12px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif">proxy_pass <a href="http://app_server" target="_blank">http://app_server</a>;</span><br>


</div><div>to<br></div><div><span style="line-height:21px;font-size:12px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif">proxy_pass <a href="http://app_server/de/" target="_blank">http://app_server/de/</a>;</span><br>


</div><div><span style="line-height:21px;font-size:12px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif"><br>


</span></div><div>brings me the error: Starting nginx: nginx: [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:121</div>


<div>nginx: configuration file /etc/nginx/nginx.conf test failed</div><div><br></div><div><br></div><div>Regarding: <a href="http://nginx.org/r/map" style="font-size:13px;font-family:arial,sans-serif" target="_blank">http://nginx.org/r/map</a> :</div>


<div>Sounds like the way to go in order to map domian/subsomains to values ( :</div><div><br></div><div>Regarding: <a href="http://nginx.org/r/proxy_pass" style="font-size:13px;font-family:arial,sans-serif" target="_blank">http://nginx.org/r/proxy_pass</a></div>


<div><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><br></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal">I tried using the "unix:socket" format, in my case: </span></pre>


<pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal">proxy_pass http://unix:/tmp/.sock:/it/</span></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px">

<span style="color:rgb(34,34,34);font-family:arial;white-space:normal">as the example in the page you sent, and got the same error.</span><br></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal"><br>

</span></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal"><br>
</span></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal">Thanks a lot for your tips, it definitely helped me to understand it better.</span></pre>


<pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal"><br></span></pre><pre style="margin-bottom:0px;margin-top:0px;padding:0px"><span style="color:rgb(34,34,34);font-family:arial;white-space:normal">So far the best solution i can see is </span><span style="font-family:arial;white-space:normal">using map in order to map the addresses to "language codes", and then execute the rewrite.</span></pre>

<pre style="margin-bottom:0px;margin-top:0px;padding:0px"><br></pre>
</div><div><br></div><div class="gmail_extra">peace<br><br><div class="gmail_quote">On 5 May 2013 09:16, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Sun, May 05, 2013 at 02:38:17AM +0100, henrique matias wrote:<br>
<br>
Hi there,<br>
<br>
</div><div>> Also i tried adding the address to the try_files:<br>
><br>
> try_files $uri $uri @app/de/; and try_files $uri $uri @app/de;<br>
><br>
> but that didn't work either.<br>
<br>
</div>Unless you also added new named locations like "@app/de/", I'd expect<br>
that to return HTTP 500.<br>
<br>
That's a more specific problem report than "didn't work".<br>
<div><br>
> The core basic of my problem is  "Rewrite the URL based on the "server<br>
> name"".<br>
><br>
> So far the only options i see on nginx are:<br>
><br>
> 1. Have a configuration with one "if" and one "rewrite" in order to map<br>
> server name to path<br>
<br>
</div><a href="http://nginx.org/r/map" target="_blank">http://nginx.org/r/map</a><br>
<br>
Set a (possibly empty) variable called (say) $path_prefix, and then use<br>
that in your rewrite or proxy_pass line.<br>
<br>
Note that using a variable in proxy_pass has other requirements too:<br>
<br>
<a href="http://nginx.org/r/proxy_pass" target="_blank">http://nginx.org/r/proxy_pass</a><br>
<div><br>
> 2. Multiple server declarations sharing the same configuration ( probably<br>
> using some sort of include? )<br>
<br>
</div>Can work, if the shared configuration is truly the same.<br>
<div><br>
> What you reckon? Any suggestion ?<br>
<br>
</div>I still think that until you demonstrate that your back-end works with<br>
this, the rest is not useful.<br>
<br>
Test one thing at a time, and keep the configuration simple.<br>
<div><div><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>
</div></div></blockquote></div><br></div></div>