location - nginx on separate server proxy_pass to multiple rails apps with sub URI on passenger standalone in different boxes -
location - nginx on separate server proxy_pass to multiple rails apps with sub URI on passenger standalone in different boxes -
i have requirement, there multiple rails applications. each application deployed in 2 app servers, (app1 , app2) , load balanced through nginx on separate server (lb).
the lb box contains plain vanilla nginx without passenger plugins. rails applications deployed on passenger stand alone.
all rails applications need run on same domain different sub_uri, below
http://www.example.com/rails1 http://www.example.com/rails2i have lb box nginx configuration below.
http { ... upstream rails1_cluster { ip_hash; server app1.server:3001; server app2.server:3001; } upstream rails2_cluster { ip_hash; server app1.server:3002; server app2.server:3002; } ... server { server_name www.example.com; ... ... location /rails1 { proxy_pass http://rails1_cluster; ... } location /rails2 { proxy_pass http://rails2_cluster; ... } .... } }
with setup, app running on passenger standalone in app1 , app2 throws error unable find route /rails1/.
this article "how deploy phusion passenger subdirectory, routing errors, , restarting" tries address same problem, suggests changing routes, don't wish do. rails applications dealing of same code base of operations customized specific instances catering specific client.
in passenger plugin nginx server, there passenger_base_uri helps in setting sub uri app. equivalent of same in case of passenger stand alone? or missing fundamental here? help, suggestions help.
give try, using rewrite module:
location /rails2 { rewrite "/rails2/" / break; proxy_pass http://rails2_cluster; }
it's regex might go on fire if url contains that. 1 not yet work addresses without trailing slash, check this.
nginx location uri passenger
Comments
Post a Comment