Windows 7旗舰版64位/ Mongrel / Apache 2.2

时间:2011-10-04 06:02:06

标签: ruby-on-rails windows apache mongrel

我在Windows 7旗舰版64位PC上设置了Ruby on Rails应用程序。

3个Mongrel实例用于运行rails程序,它们由Apache 2.2负载平衡。

我的httpd.conf文件的相关部分如下:

---------- httpd.conf
#define mongrel cluster
<proxy balancer://mongrelcluster>
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
BalancerMember http://127.0.0.1:3003
</proxy>

Listen 3009

#forward requests to mongrel cluster
<virtualhost *:3009>


  ProxyPass / balancer://mongrelcluster/
  ProxyPassReverse / balancer://mongrelcluster/
  ProxyPreserveHost on
</virtualhost>
----------- httpd.conf

我可以单独访问端口3001,3002和3003上的localhost而没有任何问题。

当我尝试通过Apache访问端口3009上的localhost时,我收到“暂时不可用的服务” 由于维护停机或容量问题,服务器暂时无法为您的请求提供服务。请稍后再试。“错误消息。

检查Apache错误日志时:

---- Error log 
[Tue Oct 04 12:46:37 2011] [notice] Child 6168: Child process is running  
[Tue Oct 04 12:46:38 2011] [notice] Child 6168: Acquired the start mutex.
[Tue Oct 04 12:46:38 2011] [notice] Child 6168: Starting 64 worker threads.
[Tue Oct 04 12:46:38 2011] [notice] Child 3052: Released the start mutex
[Tue Oct 04 12:46:39 2011] [notice] Child 3052: All worker threads have exited.
[Tue Oct 04 12:46:39 2011] [notice] Child 3052: Child process is exiting
[Tue Oct 04 12:46:39 2011] [notice] Child 6168: Starting thread to listen on port 80.
[Tue Oct 04 12:46:39 2011] [notice] Child 6168: Starting thread to listen on port 3009.
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions.  : proxy: HTTP: attempt to connect to  127.0.0.1:3001 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions.  : proxy: HTTP: attempt to connect to 127.0.0.1:3002 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
[Tue Oct 04 12:46:46 2011] [error] (OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions.  : proxy: HTTP: attempt to connect to 127.0.0.1:3003 (127.0.0.1) failed
[Tue Oct 04 12:46:46 2011] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
---- Error log 

Apache错误日志显示与Mongrel实例的连接以某种方式失败。

在我看来是一个Windows 7问题,因为相同的设置在Windows XP系统上运行良好。

欢迎所有建议/提示/解决方案。

1 个答案:

答案 0 :(得分:0)

我建议您切换到Linux或Mac OS X,当涉及到ruby on rails并尝试使用Nginx。它更加可靠,稳定,快速。 Rails有很多非常有用的宝石。说实话,红宝石社区并不关心窗户。事实是,这些宝石不会针对Windows进行更新,并且在某些极少数情况下不会针对Windows兼容性进行更新。您可以尝试使用Ubuntu(我经常使用它),并跳转到nginx或WEBrick,它随附ruby安装本身,正如您已经知道的那样。 因此,为了充分利用Ruby on Rails,离开Windows将是一个更好的选择。 Read This