I posted the below earlier, but nobody has replied. I think I found the solution to part of my problem but my solution introduces a new issue.<br><br>I added the following directive to pass <a href="http://my.domain.com/user_management/">http://my.domain.com/user_management/</a> to the correct mongrel cluster.<br>
<br>location /user_management_dev/ {<br> root /var/www/rails/user_management/current/;<br> rewrite /user_management_dev(.*) $1;<br> proxy_pass <a href="http://user_management_prod">http://user_management_prod</a>;<br>
break;<br>}<br><br>The problem is that now the application sees it's url as being <a href="http://my.domain.com">http://my.domain.com</a> so all the links inside the rails application don't go anywhere. Is there a way to tell the proxied application that it needs to add "/user_management" to the end of it's host name?<br>
<br>-----------------------------------<br><br><div class="gmail_quote">On Thu, Feb 21, 2008 at 5:18 PM, Brandon Hoult <<a href="mailto:bhoult@gmail.com">bhoult@gmail.com</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;">
I would like to have several rails applications behind the same domain name.<br><br>For example:<br><a href="http://my.domain.com/application_1" target="_blank">my.domain.com/application_1</a><br><a href="http://my.domain.com/application_2" target="_blank">my.domain.com/application_2</a><br>
<a href="http://my.domain.com/application_3" target="_blank">my.domain.com/application_3</a><br><br>These then need to be directed to the appropriate mongrel server. My current config below would work fine if I had <a href="http://application1.domain.com" target="_blank">application1.domain.com</a>, <a href="http://application2.domain.com" target="_blank">application2.domain.com</a> etc. But I can't seem to find an example of how to use the same domain with different apps.<br>
<br>Any hints would be appreciated.<br><br>My curent config:<br>
-------------------------------------------------------------------------------<br>upstream rails {<br> server <a href="http://127.0.0.1:8050" target="_blank">127.0.0.1:8050</a>;<br> server <a href="http://127.0.0.1:8051" target="_blank">127.0.0.1:8051</a>;<br>
}<br><br>#Rails App here<br>server {<br> listen 80;<br> server_name <a href="http://rails.softwyre.com" target="_blank">rails.softwyre.com</a>;<br> root /var/www/rails/user_management/current/;<br> index index.html index.htm;<br>
client_max_body_size 50M;<br><br> access_log /var/log/nginx/localhost.access.log;<br><br> proxy_set_header X-Real-IP $remote_addr;<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> location / {<br> if (-f $request_filename) {<br> break;<br> }<br> if (-f $request_filename/index.html) {<br> rewrite (.*) $1/index.html break;<br>
}<br> if (-f $request_filename.html) {<br> rewrite (.*) $1.html break;<br> }<br> if (!-f $request_filename) {<br> proxy_pass <a href="http://rails" target="_blank">http://rails</a>;<br>
break;<br>
}<br> }<br><br> # redirect server error pages to the static page /50x.html<br> #<br> error_page 500 502 503 504 /500.html;<br> location = /500.html {<br> root /var/www/rails/user_management/current/public;<br>
}<br>}<br><br>
</blockquote></div><br>