【问题标题】:Windows 7 Ultimate 64-bit / Mongrel / Apache 2.2Windows 7 Ultimate 64 位 / Mongrel / Apache 2.2
【发布时间】:2011-11-30 10:13:32
【问题描述】:

我在 Windows 7 Ultimate 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 系统上运行良好。

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

【问题讨论】:

    标签: ruby-on-rails windows apache mongrel


    【解决方案1】:

    我建议您在使用 ruby​​ on rails 时切换到 Linux 或 Mac OS X,并尝试使用 Nginx。它更加可靠、稳定和快速。 Rails 有很多非常有用的 gem。老实说,Ruby 社区并不关心 Windows。事实是这些 gem 没有针对 windows 进行更新,并且在极少数情况下不是为 windows 兼容性而构建的。您可以尝试使用 Ubuntu(我经常使用它)弄脏您的手,也可以跳转到 ruby​​ 安装本身附带的 nginx 或 WEBrick,正如您已经知道的那样。 因此,为了充分利用 Ruby on Rails,离开 Windows 将是一个更好的选择。 Read This

    【讨论】:

    • 终于找到了答案。我必须从 windows/system32/drivers/etc/hosts 文件中删除“::1”行。
    猜你喜欢
    • 2014-04-19
    • 2011-01-07
    • 2013-11-10
    • 2012-10-26
    • 2013-01-12
    • 1970-01-01
    • 1970-01-01
    • 2017-06-08
    • 1970-01-01
    相关资源
    最近更新 更多