Nginx and Phusion Passenger (Configuring mutliple Virtual Hosts)

I am trying to setup multiple Ruby on Rails apps on my local machine with Phusion Passenger and Nginx. Unfortunately I can't seem to find a good solution for doing this with a google search. Some solutions I've seen included creating a symlink but essentially what I would like to do is have a different nginx.conf per project and have Phusion Passenger load that file up from perhaps ~/Sites/project/config/nginx.conf in my Ruby on Rails app. Is this possible? If so, how can I achieve that? and If not, what other solutions are there that might point me in the right direction?

Thanks for your help!

==========

Possible Solution

==========

Using RVM I created a new gemset, I then installed the phusion passenger gem under that gemset and during the installation of nginx, I specified the nginx to be installed under ~/Sites/project/config/

This essentially created the following directories:

  • project
  • config
  • conf
  • sbin
  • Inside of the project/config/conf exists the nginx.conf file which /project/config/sbin/nginx uses to create its own virtual host. Although I'm sure I can use my centralized nginx configuration at /opt/nginx , the difference is that this helps create a project that can be easily distributable to other devs who are working on the project as well. Any thoughts/concerns?


    Since you're on Mac, try out http://pow.cx/

    To create a new project/site

    cd ~/.pow
    ln -s /path/to/myapp
    

    Then you'll access via http://myapp.dev


    This looks like it might do it for you (see the sections starting with "upstream ..."). What this basically does is point the incoming requests to different server clusters (even if running locally) based on the request URL.

    http://purab.wordpress.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/

    This example uses Mongrel clusters on the back end, but just compare it to your current config, and make adjustments for your specific back end.

    链接地址: http://www.djcxy.com/p/32480.html

    上一篇: 如何在使用乘客的Nginx服务器中部署Rails项目?

    下一篇: Nginx和Phusion Passenger(配置多个虚拟主机)