通过 .htaccess 进行 Phusion 乘客配置

发布于 2024-09-25 04:22:02 字数 1028 浏览 0 评论 0原文

我正在尝试安装 Redmine,但在使 Phusion Passenger 无法处理除 DocumentRoot 之外的任何目录时遇到问题。

我将从Redmine下载的公共目录放入~/www/public/entry/redmine.mysite.com/,其余目录放入~/www/app/redmine.mysite.com/。

我已将以下行添加到公共文件夹内的 .htaccess 文件中:

PassengerAppRoot ~/www/app/redmine.mysite.com

每当我尝试加载页面时,它只会给我简单的 Mozilla 文件未找到页面。

有什么想法吗?


附加信息:

我设置了一个代码库,以便 apache 将任何给定的请求 URI 解析到特定的条目文件夹,如下所示:

DocumentRoot 是 ~/www/public

在此文件夹中是一个 .htaccess 文件,包括以下规则:

RewriteCond ${lowercase:%{SERVER_NAME}} ^(dev\.)?(stg\.)?(www\.)?(.*)$
RewriteCond %{REQUEST_URI} !^/resource/(.*)$
RewriteRule !^entry/ entry/%4%{REQUEST_URI}

如果我创建端口 3000 的新虚拟主机,DocumentRoot=~/www/public/entry/redmine.mysite.com/,一切都正确加载。

但是,如果我使用代码库的基于 mod_rewrite 的分辨率,则会收到页面未找到错误。


如果我访问 redmine.mysite.com/404.html,它会加载正确文件夹中的 404.html 页面。


如果我将 PassengerAppRoot 更改为 ~/www/app/redmine.mysite.com/test,它会通知我该目录似乎不是有效的 Ruby on Rails 应用程序根目录。

I'm trying to install Redmine, and I am having trouble making Phusion Passenger work with any directories other than the DocumentRoot.

I've put the public directory downloaded from Redmine into ~/www/public/entry/redmine.mysite.com/, and the rest of the directories in ~/www/app/redmine.mysite.com/.

I've added the following line to the .htaccess file inside the public folder:

PassengerAppRoot ~/www/app/redmine.mysite.com

Whenever I try to load up the page, it just gives me the plain Mozilla file not found page.

Any thoughts?


Additional Info:

I have a codebase set up so that apache resolves any given request URI to a particular entry folder, as follows:

DocumentRoot is ~/www/public

In this folder is a .htaccess file, including the following rule:

RewriteCond ${lowercase:%{SERVER_NAME}} ^(dev\.)?(stg\.)?(www\.)?(.*)$
RewriteCond %{REQUEST_URI} !^/resource/(.*)$
RewriteRule !^entry/ entry/%4%{REQUEST_URI}

If I create a new VirtualHost for port 3000, with DocumentRoot=~/www/public/entry/redmine.mysite.com/, everything loads up correctly.

However, if instead I use my codebase's mod_rewrite-based resolution, I get a page not found error.


If I visit redmine.mysite.com/404.html, it loads the 404.html page that is in the correct folder.


If I change the PassengerAppRoot to ~/www/app/redmine.mysite.com/test, it informs me that the directory does not appear to be a valid Ruby on Rails application root.

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

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

发布评论

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

评论(1

谈情不如逗狗 2024-10-02 04:22:02

看起来解决方案是将 RailsBaseURI 设置为服务器上 DocumentRoot 的相对路径,而不是 REQUEST_URI!

我原以为它指的是实际的 URI 字符串,但事实证明并非如此!

Looks like the solution was to set RailsBaseURI to the path relative from the DocumentRoot on the server, not the REQUEST_URI!

I had thought it referred to the actual URI string, but it turns out that is not the case!

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