Phusion Passenger + Nginx Virtual Host Configuration for Ruby on Rails Application in Debian 6

↘锁芯ラ 提交于 2019-12-04 18:25:28

I hope you found the solution by now, but for the sake of stackoverflow archive I'm going to provide an answer.

Generaly meaning you should use reverse proxy (http://wiki.nginx.org/RubyonRailsMongrel) with nginx, while your upstream will be a passenger|thin|unicorn|puma|mongrel (pick your favorite) server runnning your dedicated rails application (I will use duplicated code in order to isolate your client running environment.) You'll be able to provide load balancing with this method.

Now, you stipulate the use of Passenger, you could use a really simple setup if you compile nginx with passenger extention. (go to http://www.modrails.com/documentation/Users%20guide%20Nginx.html for better explanation)

server {
  listen 80;
  listen [::]:80 default_server ipv6only=on; # please for a better world be IPv6 compliant !
      server_name www.client1.product.com;
  root /my/rails/app1;
      passenger_enabled on;
}
server {
  listen 80;
  listen [::]:80 default_server ipv6only=on;
      server_name www.client2.product.com;
  root /my/rails/app2;
      passenger_enabled on;
}

.......

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!