【发布时间】:2021-03-25 19:40:21
【问题描述】:
我正在尝试从 Apache+Passenger 加载 NodeJS 应用程序。
操作系统:Centos 7 / CloudLinux 7.9 版
Apache:2.4.6 (httpd-2.4.6-97.el7_9.cloudlinux.x86_64)
Passenger:Phusion Passenger 6.0.7(passenger-6.0.7-1.el7.x86_64, mod_passenger-6.0.7-1.el7.x86_64)来自Passenger's Yum repo
虚拟主机指向/home/vhost1/public_html,NodeJS App指向/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
W.r.t.第一个链接文档中的乘客指令,在指令的上下文中 .htaccess is missing 。但同样存在于第二个链接文档中
现在我有 2 个问题
- 两个文档是否正确或我遗漏了什么。 ?
- 为什么相同的设置在安装了Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 软件包的cPanel 服务器上的CloudLinux 7 上运行良好?
谢谢
基尔蒂·辛格
【问题讨论】:
标签: apache .htaccess apache2.4 passenger-apache