Ruby 应用程序仅在 Passenger 被“禁用”时才起作用。

发布于 2024-10-01 11:22:14 字数 477 浏览 0 评论 0原文

我已经使用 Apache 和 Passenger 在 Ubuntu 服务器上部署了 Sinatra 应用程序。通过一些试验和错误,我意识到该应用程序仅在乘客模块被禁用时才能工作。

$ a2dismod passenger

Apache 重新启动后,应用程序将按预期运行。

如果我重新启用该模块...

$ a2enmod passenger

...我在 Apache 重新启动时看到此警告:

[warn] module passenger_module is already loaded, skipping

并且应用程序停止工作。 Apache 做出响应,提供虚拟主机文档根目录的内容,但 Passenger 无法识别。

我很高兴我的应用程序可以工作,但我不确定如何解释启用/禁用乘客模块的相反效果。

I have deployed a Sinatra application on an Ubuntu server using Apache and Passenger. Through some trial and error, I realize the app only works when the passenger module is disabled.

$ a2dismod passenger

After an Apache restart, the app runs as expected.

If I re-enable the module...

$ a2enmod passenger

...I see this warning upon Apache restart:

[warn] module passenger_module is already loaded, skipping

and the app stops working. Apache responds, serving the contents of the vhost's document root, but is not recognized by Passenger.

I'm glad my app works, but I'm not sure how to explain the reversed effect of enabling/disabling the passenger module.

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

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

发布评论

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

评论(2

浪荡不羁 2024-10-08 11:22:14

我遇到了同样的问题:如果您遵循此版本 Apache 的乘客安装说明,您实际上可能会告诉 Apache 加载乘客两次。

在将这 3 行著名的行添加到您的 Apache 配置文件之前:

LoadModule passenger_module /usr/…/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby

检查配置文件 apache2.conf 中是否存在如下行:

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

如果这些行确实存在,则意味着在启动时您的 Apache 服务器将包含来自 / 的每个 *.conf 和 *.load 文件mods-available 到 /mods-enabled 并加载它们。

因此,如果您遇到相关警告消息,则意味着您正在加载乘客模块两次!

您可以利用 Apache 的这一功能,转到 /mods-available,查找 Passenger.conf 和 Passenger.load 文件并编辑它们,而不是编辑 apache2.conf。

'LoadModule Passenger_module'行进入passenger.load,而其他2行'PassengerRoot'和'PassengerRuby'行进入passenger.conf。

然后重新启动你的服务器就可以了。

有关此问题的更多信息,请访问:http:// www.duccioarmenise.net/ruby-on-rails/warn-module-passenger_module-is-already-loaded/

I ran into the same problem: if you follow passenger installing instruction with this version of Apache you may actually tell Apache to load passenger twice.

Before adding the 3 famous lines to your Apache configuration file:

LoadModule passenger_module /usr/…/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby

Check the configuration file apache2.conf for lines like these:

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

If these lines do exists it means that on start your Apache server will include every *.conf and *.load file from /mods-available to /mods-enabled and than load them.

So if you run in the concerning warning message it means you are loading passenger module twice!

You can take advantage of this Apache feature going to /mods-available, looking for passenger.conf and passenger.load files and edit them instead of apache2.conf.

The ‘LoadModule passenger_module’ line goes into passenger.load, while the other 2 ‘PassengerRoot’ and ‘PassengerRuby’ lines go into passenger.conf.

Then restart your server and you’ll be fine.

More about this issue here: http://www.duccioarmenise.net/ruby-on-rails/warn-module-passenger_module-is-already-loaded/

聊慰 2024-10-08 11:22:14

这很可能意味着您已指定“LoadModule Passenger_module ...”两次。第一个条目不在passenger.conf 中,第二个条目在passenger.conf 中。

This most likely means you've specified 'LoadModule passenger_module ...' twice. The first entry is somewhere not in passenger.conf, the second entry is in passenger.conf.

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