Apache/Passenger 反向代理到 Passenger 独立版无法正常工作

发布于 2024-12-10 18:00:10 字数 1656 浏览 0 评论 0原文

我想在同一台机器上运行 Rails 3 和 Rails 2.3.8 应用程序。我目前为我的 Rails 3 应用程序使用 Ruby 1.9.2 设置了 Passenger,并且与 Apache 配合得很好。我在 Phusion 网站上找到了以下内容,并正在尝试反向代理:

http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/

此应用程序的 Apache 虚拟主机文件如下所示:

<VirtualHost *:80>
ServerName gtt
DocumentRoot /home/purvez/www/gtt/public
RailsEnv development
PassengerEnabled off
ProxyPass / http://127.0.0.1:3000
ProxyPassReverse / http://127.0.0.1:3000
</VirtualHost>

我可以正确访问应用程序使用乘客独立使用:

127.0.0.1:3000/start

但是当我尝试访问它时:

http://gtt/start

我收到一条消息:

没有路线匹配[GET]“/start”

Apache然而,“other_vhosts_access.log”显示了此条目:

testapp:80 127.0.0.1 - - [20/Oct/2011:15:27:58 +0100] "GET /start HTTP/1.1" 404 737 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

如您所见,它正在尝试调用 testapp:80 而不是 gtt:80。我的 /etc/hosts 文件中都有这些,事实上 gtt 是在 testapp 之前!

我在这里做错了什么以及如何纠正?

编辑

我非常尴尬!我没有在 Ubuntu 上启用该站点,因此它正在查看唯一可用的站点,即 testapp。

然而,纠正问题后我仍然收到 500 错误。 “other_vhosts_access.log”条目显示:

gtt:80 127.0.0.1 - - [20/Oct/2011:18:07:30 +0100] "GET /start HTTP/1.1" 500 599 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

这几乎就像 Passenger 独立代理没有发生,而 Apache 正在尝试自行启动。当然,passenger.3000.log(即独立的乘客日志)根本没有显示任何活动!

因此,在犯了一个巨大的错误并浪费了每个人的时间之后,我仍然处于同一条船上,因为看起来代理并没有发生!

有人有什么想法吗?

I want to run rails 3 and rails 2.3.8 apps on the same machine. I currently have Passenger setup with Ruby 1.9.2 for my rails 3 apps and that is working fine with Apache. I found the following at the Phusion website and am trying out the reverse proxy :

http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/

My Apache vhost file for this app looks like:

<VirtualHost *:80>
ServerName gtt
DocumentRoot /home/purvez/www/gtt/public
RailsEnv development
PassengerEnabled off
ProxyPass / http://127.0.0.1:3000
ProxyPassReverse / http://127.0.0.1:3000
</VirtualHost>

I can correctly access the app using passenger standalone using:

127.0.0.1:3000/start

but when I try to access it as :

http://gtt/start

I get a message saying:

No route matches [GET] "/start"

The Apache 'other_vhosts_access.log' however shows this entry:

testapp:80 127.0.0.1 - - [20/Oct/2011:15:27:58 +0100] "GET /start HTTP/1.1" 404 737 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

As you can see it is trying to call testapp:80 rather than gtt:80. I have both these in my /etc/hosts file and in fact gtt is BEFORE testapp!

What am I doing wrong here and how to put it right?

Edit

I am mega embarrassed! I had not enabled the site on Ubuntu and hence it was looking at the only available site i.e. testapp.

However having corrected the problem I'm still getting a 500 Error. The 'other_vhosts_access.log' entry shows:

gtt:80 127.0.0.1 - - [20/Oct/2011:18:07:30 +0100] "GET /start HTTP/1.1" 500 599 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1"

It's almost like the proxy to Passenger standalone is not happening and that Apache is trying to get start itself. Certainly the passenger.3000.log (i.e. standalone Passenger log) is showing no activity at all!

So having made a monumental blunder and wasted everyone's time initially I'm still in the same boat in that it looks like the Proxy is not happening!!

Anyone got any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

维持三分热 2024-12-17 18:00:10

(代表问题作者发布)

解决了!我已经启用了 proxy_module,但我还需要启用 proxy_http 模块。这终于解决了问题。唷!!

(Posted on behalf of the question author).

Solved! I had enabled the proxy_module but I also needed to enable the proxy_http module. That finally solved the problem. Phew!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文