ruby on rails - How to use different rails_env with nginx, passenger and redmine -


i need have redmine running in combination nginx, phusion passenger , mysql. because of project requires several instances of redmine, should realized using different rails_env, tried set them in different server vhosts nginx.

example of 1 vhost:

server {     listen xxxx;     server_name redmine.xxxxx;     root /xxxxx/redmine/public;     passenger_enabled on;     rails_env production; } 

same goes other server vhost, there server_name matched other domain , rails_env set internal.

the problem is, nginx uses 1 of both rails_env both redmine instances, not 1 each. advice how use different rails_env same application, nginx , phusion passenger?

thanks

i think you're having same problem had. want use same physical directory host application instances want interact app under different environments (development/production) using different dns entries (redmine.development / redmine.production)???

the problem passenger recognizes incoming request using rails app found in directory above root. if you're using same literal reference root in multiple nginx configs, passenger forward request single running instance found in root. i.e., if start development application first, try access production via redmine.production, you'll end interacting development environment. if start production app first, try access redmine.development, you'll end interacting production.

the answer symlink app's directory every environment want run. passenger looks @ literal path root - if doesn't match running instance, it'll spawn new one.

ex.)

physical root ~/rails_apps/myserver (where myserver contains app, public, etc.)

create symlink called ~/rails_apps/dev.myserver ~/rails_apps/myserver , 1 called ~/rails_apps/pro.myserver ~/rails_apps/myserver.

now inside nginx config, use symlink locations public folder root.

ex., if symlink /home/user/rails_apps/[dev|pro].redmine points /home/user/rails_apps/redmine)

server {     listen xxxx;     server_name redmine.development;     root /home/user/rails_apps/dev.redmine/public;     passenger_enabled on;     rails_env development; } server {     listen xxxx;     server_name redmine.production;     root /home/user/rails_apps/pro.redmine/public;     passenger_enabled on;     rails_env production; } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -