简体   繁体   English

如何使Rails在Nginx上的Passenger下运行?

[英]How can I get Rails to run under Passenger on Nginx?

I am really struggling with this. 我真的为此感到挣扎。 I have decided to switch to Passenger after having so many struggles with Passenger/Ruby on Apache. 在与Apache上的Passenger / Ruby进行了许多斗争之后,我决定切换到Passenger。 Ruby processes kept chewing up CPU, and taking 30 minutes to process a syntax error in a view. Ruby进程一直在消耗CPU资源,并且花费30分钟来处理视图中的语法错误。

So now I have the same problem. 所以现在我有同样的问题。 I installed Passenger no problem. 我安装乘客没问题。 Followed the directions to use Passenger to download and install Passenger. 按照说明使用“乘客”下载并安装“乘客”。 Done. 做完了 I am using Ruby Enterprise version. 我正在使用Ruby Enterprise版本。

I added the Passenger-specified server entry into my nginx.conf for my Rails 3 application. 我为我的Rails 3应用程序将乘客指定的服务器条目添加到了我的nginx.conf中。 nginx -t says the syntax of the conf file is good. nginx -t表示conf文件的语法很好。

I start nginx with: 我从以下内容开始nginx:

sudo nginx

seems to start. 似乎开始。 Then I go to the url I specified in my conf file and it just CHURNS. 然后转到我在conf文件中指定的网址,它只是CHURNS。 I can see in Activity Monitor that a ruby processor comes up and just SPINS, chewing up CPU as it goes. 我可以在Activity Monitor中看到一个红宝石处理器出现了,而只是SPINS,随着它的运行咀嚼着CPU。 Up to 100% until I have to reboot my machine. 最多100%,直到必须重新启动计算机。

What is wrong? 怎么了? This is maddening, I REALLY appreciate any help. 这太疯狂了,我非常感谢您的帮助。

That sounds more like your server has so little RAM that it can't even start a single Rails process without swapping to death. 这听起来更像是您的服务器的RAM太少,以至于它甚至无法启动就无法启动单个Rails进程。 Try running script/console from a terminal. 尝试从终端运行脚本/控制台。 Does that work and does it work quickly? 这行得通吗,并且行得通吗?

It's either that, or you have a bug in your application's startup code which causes this behavior. 就是这样,或者您的应用程序的启动代码中有错误导致此行为。

Take a look at: 看一眼:

http://library.linode.com/frameworks/ruby-on-rails-nginx/ http://library.linode.com/frameworks/ruby-on-rails-nginx/

Slicehost is also an excellent source for this kind of help (though I'm not sure if they have a Passenger/nginx tutorial at the moment): Slicehost也是此类帮助的绝佳来源(尽管我不确定他们目前是否有“乘客/ nginx”教程):

http://articles.slicehost.com/ http://articles.slicehost.com/

I've used tutorials from both sites and they are very clear and helpful. 我已经使用了来自这两个站点的教程,它们非常清楚并且很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM