Apache 乘客解析符号链接停止工作 | 命令无效

LKK*_*ThX 4 redmine phusion-passenger apache-2.4

我有一个安装了 Apache 2.4.18 和 redmine 的 Ubuntu 服务器(16.04.3 LTS),遵循这个安装指南

因此,我编辑了 ssl.confapache2/sites-available并添加了以下几行:

<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
   ...

    <Directory /var/www/html/redmine>
      RailsBaseURI /redmine
      PassengerResolveSymlinksInDocumentRoot on
    </Directory>

  </VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)

这曾经工作了几个月,但今天我编辑了ssl.conf添加另一个位置。现在 Apache 重启失败并systemctl status apache2.service显示以下错误消息:

命令“PassengerResolveSymlinksInDocumentRoot”无效,可能拼写错误或由服务器配置中未包含的模块定义

我既没有更改 redmine 部分的任何内容,ssl.conf也没有启用或禁用任何 Apache 模块。

即使恢复更改也无助于避免此错误消息。

评论PassengerResolveSymlinksInDocumentRoot使 Apache 再次工作,但禁用 redmine 安装。

passenger-config validate-install 如果该行被注释,则返回零错误,如果该行未注释,则返回“您的 Apache 安装可能已损坏”。

有什么办法可以解决这个问题,或者我应该检查其他文件来解决这个错误吗?

小智 9

我已经设法解决了这个问题

PassengerResolveSymlinksInDocumentRoot
Run Code Online (Sandbox Code Playgroud)

该选项已在 5.2.0 版本中删除

https://blog.phusion.nl/2018/01/29/passenger-5-2-0/

所以有2种方法可以修复它

1.不要在DocumentRoot中使用符号链接

2.在虚拟主机Apache中使用参数PassengerAppRoot(如果在DocumentRoot中使用符号链接)

<VirtualHost *:443>
    ServerName myservername
    DocumentRoot /var/www/redmine
    PassengerAppRoot /opt/redmine/redmine
…
</VirtualHost>

# ls -l /var/www/redmine
lrwxrwxrwx 1 root root 27 Apr 27  2017 /var/www/redmine -> /opt/redmine/redmine/public
Run Code Online (Sandbox Code Playgroud)