Hi Cathal, ..<br><br>You need two mongrel cluster instances, one per each rails app ok!<br><br>eg:<br><br>upstream mongrel_app_1 {<br> server <a href="http://127.0.0.1:8000">127.0.0.1:8000</a>;<br> server <a href="http://127.0.0.1:8001">127.0.0.1:8001</a>;<br>
server <a href="http://127.0.0.1:8002">127.0.0.1:8002</a>;<br> }<br><br>upstream mongrel_app2_2 {<br> server <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br> server <a href="http://127.0.0.1:9001">127.0.0.1:9001</a>;<br>
server <a href="http://127.0.0.1:9002">127.0.0.1:9002</a>;<br> }<br><br>Currently I'm hosting two rails app in my OpenBSD server.<br><br>Regards.<br><br><div class="gmail_quote">On Wed, Apr 2, 2008 at 5:30 PM, Cathal <<a href="mailto:coriordan@tssg.org">coriordan@tssg.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
I'm trying to configure nginx to serve multiple rails applications, each from<br>
its own path. app1 is accessible from '/' and app2 is accessible from '/app2'.<br>
<br>
In my configuration I've defined two location's as follows:<br>
<br>
-- begin snip! --<br>
<br>
# app1<br>
location / {<br>
<br>
root /u/apps/app1/current/public;<br>
<br>
proxy_set_header X-Real-IP $remote_addr;<br>
<br>
# needed for HTTPS<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_set_header Host $http_host;<br>
proxy_redirect false;<br>
proxy_max_temp_file_size 0;<br>
<br>
if (-f $request_filename) {<br>
break;<br>
}<br>
<br>
if (-f $request_filename/index.html) {<br>
rewrite (.*) $1/index.html break;<br>
}<br>
<br>
if (-f $request_filename.html) {<br>
rewrite (.*) $1.html break;<br>
}<br>
<br>
if (!-f $request_filename) {<br>
proxy_pass <a href="http://mongrel_app1" target="_blank">http://mongrel_app1</a>;<br>
break;<br>
}<br>
}<br>
<br>
#app2<br>
location /app2 {<br>
<br>
root /u/apps/app2/current/public;<br>
proxy_set_header X-Real-IP $remote_addr;<br>
<br>
# needed for HTTPS<br>
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>
proxy_set_header Host $http_host;<br>
proxy_redirect false;<br>
proxy_max_temp_file_size 0;<br>
<br>
<br>
if (-f $request_filename) {<br>
break;<br>
}<br>
<br>
if (-f $request_filename/index.html) {<br>
rewrite (.*) $1/index.html break;<br>
}<br>
<br>
if (-f $request_filename.html) {<br>
rewrite (.*) $1.html break;<br>
}<br>
<br>
if (!-f $request_filename) {<br>
proxy_pass <a href="http://mongrel_app2" target="_blank">http://mongrel_app2</a>;<br>
break;<br>
}<br>
}<br>
<br>
-- end snip! --<br>
<br>
The problem is that nginx is trying to resolve static files for /app2 along the<br>
/app2 path inside my rails application's public directory, which doesn't exist.<br>
<br>
The only way I've been able to make the above configuration work is to create a<br>
symbolic from 'app2' to 'public'. Is there some way to tell nginx to ignore the<br>
location part it has already matched when dealing with a request?<br>
<br>
regards,<br>
<font color="#888888">C.<br>
<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Francisco Valladolid H.<br> -- <a href="http://bsdguy.net">http://bsdguy.net</a> - Jesus Christ follower.