2011-10-18 24 views
2

我有一个网站:http://foo.com 我想在添加一个Rails应用程序:http://foo.com/subdir 所以我使用Apache代理去做。部署在一个子目录中Rails应用程序与客运

在与Rails应用程序的服务器,我有乘客和Apache,我的虚拟主机:

<VirtualHost *:80> 
    ServerName 1.2.3.4 

    DocumentRoot /path/to/railsapp/public 
    RailsEnv production 
</VirtualHost> 

当我去http://foo.com/subdir,所有的路径都incorect(http://foo.com/图像,http://foo.com/users,...等),但我想是像(http://foo.com/subdir/images,http://foo.com/subdir/users,...等)

所以,我怎么能做到这一点的子目录吗?

PS:我试过RailsBaseURI,但它不工作:(

+0

RailsBaseURI按照指定的方式工作。只需按照文档。 – AlexD

+0

如果我将“RailsBaseURI/subdir”添加到我的VirtualHost,它将返回404它是我的foo.com/subdir。 也许是因为我背后是Apache Proxy? – Dorian

+0

您是否按文档中所述创建了符号链接? – AlexD

回答

1

我搬到我的应用程序subdir/

我创建了一个与的.htaccess:

PassengerEnabled on 
PassengerAppRoot /path/to/railsapp/subdir 

我的虚拟主机:

DocumentRoot /path/to/railsapp/ 
    <Directory /path/to/railsapp/subdir> 
    AllowOverride All 
    RailsBaseURI /subdir 
    </Directory> 

谢谢AlexD试图帮助我。

1

从谷歌搜索在此处结束,所以以为我会分享这方面的先进的最新信息。

查看乘客的文件Deploying an app to a sub-URI or subdirectory

RailsBaseURI/RackBaseURI已弃用,请使用PassengerBaseURI

+0

很酷,谢谢,我没有任何手动部署的乘客应用程序,所以我不能亲自测试 – Dorian

+0

howto页面也已移动。我找到了以下页面。 https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/ – yosei

+0

好赶yosei!我编辑了答案并更改了链接 – Josh

相关问题