开发者

How do I setup my Rails Apps to Run through Phusion Passenger?

开发者 https://www.devze.com 2022-12-10 00:39 出处:网络
I have the following doubt: I have an application in Rails+MySQL开发者_JAVA技巧 and I want to run this with Apache + Passenger, I have both installed, but when I run ./script/server my app starts run

I have the following doubt:

I have an application in Rails+MySQL开发者_JAVA技巧 and I want to run this with Apache + Passenger, I have both installed, but when I run ./script/server my app starts running with WebRick, how do I change it for work with Passenger and Apache?

P.S: I'm on Ubuntu 9.04 Jaunty Jackalope, please consider the fact I'm a newbie =)


If passenger is installed (and the module is in apache), all you need to do is point an Apache VHost's DocumentRoot at your public directory. Passenger should take care of the rest.

There is no separate server to start, the app runs direct from Apache (just like mod_php, but without the cooties).

A more detailed explanation is available here.


You need to put it wherever you told Apache to serve it from. script/server will no longer be involved.


Passenger is more of an always-on type of setup. You don't use script/server to start it, because it automatically shuts down if you're not actively using it, and reactivates when you start using it again. I personally have an /etc/hosts entry that maps myapp.local to 127.0.0.1, and then I use Apache's virtual hosts to identify which Rails app to start.

<VirtualHost *:80>
  ServerName myapp.local
  DocumentRoot /apps/myapp/public
  RailsEnv development
</VirtualHost>


If you're running multiple apps on your own box (i.e. a development box) a friend of mine has got a gem that will help with the /etc/hosts writing called Ghost.

You can use it like:

sudo ghost add domain.local

And now in your browser typing domain.local will point to 127.0.0.1.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号