我正在尝试从 Apache+Passenger 加载 NodeJS 应用程序。
操作系统:Centos 7 / CloudLinux 7.9 版
阿帕奇:2.4.6(httpd-2.4.6-97.el7_9.cloudlinux.x86_64)
乘客:Phusion 乘客 6.0.7 (passenger-6.0.7-1.el7.x86_64, mod_passenger-6.0.7-1.el7.x86_64) 来自乘客的 Yum 仓库
虚拟主机指向 /home/vhost1/public_html,NodeJS 应用指向 /home/vhost1/nodeapps/np1-pass/np1-pass.js
当我通过 Apache 配置中的乘客条目运行此配置时,该应用程序可以工作并且可以从 http://virtual-host/np1-pass/ 访问。
Apache 配置中的条目如下:
<VirtualHost *:80>
ServerName virtual-host
DocumentRoot /home/vhost1/public_html
<Directory /home/vhost1>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
</Directory>
<Directory /home/vhost1/public_html>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
</Directory>
Alias /np1-pass /home/vhost1/nodeapps/np1-pass/public
<Location /np1-pass>
PassengerAppEnv development
Passengerapproot /home/vhost1/nodeapps/np1-pass
PassengerBaseURI "/np1-pass"
PassengerNodejs "/home/vhost1/bin/node"
PassengerAppType node
PassengerStartupFile np1-pass.js
</Location>
</VirtualHost>
现在我一直在尝试将Passenger指令移到/home/vhost1/public_html/np1-pass下的.htaccess文件(当然是在从Apache配置中删除这些指令以及别名和位置条目之后),这样一个虚拟主机所有者能够在不修改 Apache 配置的情况下触发应用程序,然后我收到错误消息
此处不允许PassengerAppRoot,引用者:http://virtual-host/np1-pass/
类似的 .htaccess 在安装有 Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 软件包的 cPanel 服务器上适用于 CloudLinux 7
当我研究各种解决方案时,我遇到了两个文档
- https://www.phusionpassenger.com/docs/references/config_reference/apache/#passengerapproot
- https://www.phusionpassenger.com/library/config/apache/reference/#passengerapproot
在指令的上下文中,第一个链接文档中的 Wrt 乘客指令 .htaccess is missing 。但同样存在于第二个链接文档中
现在我有2个问题
- 两个文件都是正确的还是我遗漏了什么。?
- 为什么相同的设置在安装了Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 软件包的cPanel 服务器上的CloudLinux 7 上运行良好?
谢谢
基尔蒂·辛格