Phusion Passenger 状态因套接字名称太长而崩溃

Phusion Passenger status crashing with too long socket name

我正在 Ubuntu 18.04 上尝试 passenger,几乎是通用安装和 passenger-status 调用崩溃。不太清楚如何设置它用于本地套接字通信的路径。

Version : 6.0.12
Date    : 2021-11-17 23:20:19 +0000
Instance: PdoRpeL5 (Apache/2.4.29 (Ubuntu) Phusion_Passenger/6.0.12)

Traceback (most recent call last):
    6: from /usr/sbin/passenger-status:349:in `<main>'
    5: from /usr/sbin/passenger-status:346:in `start'
    4: from /usr/sbin/passenger-status:62:in `command_show_status'
    3: from /usr/sbin/passenger-status:124:in `show_status'
    2: from /usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `http_request'
    1: from /usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `new'
/usr/lib/ruby/vendor_ruby/phusion_passenger/admin_tools/instance.rb:94:in `initialize': too long unix socket path (116bytes given but 108bytes max) (ArgumentError)

查看该代码,@path/tmp/systemd-private-af50a27a57d04fec9366f72dd251a3be-apache2.service-Dy9bBV/tmp/passenger.PPuC2RN,这使得套接字名称 /tmp/systemd-private-af50a27a57d04fec9366f72dd251a3be-apache2.service-Dy9bBV/tmp/passenger.PPuC2RN/agents.s/core_api

似乎是乘客内部问题,但我正在寻找解决方法...

您是否尝试过编辑 Web 服务器服务文件,nginx.service 或 apache2.service?我遇到了这个问题并通过删除行解决了它:

PrivateTmp=true

来自 /etc/systemd/system/multi-user.target.wants/apache2.service.

然后:

sudo systemctl daemon-reload
sudo systemctl restart apache2

https://github.com/phusion/passenger/issues/2397

“这是因为 systemd 私有 tmp 功能生成的路径有 80 个字符长,只剩下 27 个字符供应用程序使用,而 passenger 在其套接字路径中使用了 35 个字符。”