Rails 3 +乘客conf文件

时间:2013-04-17 14:16:41

标签: ruby-on-rails apache .htaccess passenger

我一直在尝试在最初用于多个php应用程序的盒子上安装rails应用程序。我安装了乘客并创建了一个conf文件,但我对它如何一起工作感到困惑。

如果我想访问Rails应用程序,我的ServerName应该是什么?这个盒子是运行apache2的debian squeeze,安装了乘客模块。以下是我的conf文件。我目前必须转到xxx.xxx.xxx.xxx/leoadmin/public以使应用程序正常运行。我在公共目录中有以下htaccess。如果我的配置文件配置正确,我认为这是不必要的。

我认为我的主要问题是配置文件的配置错误。我相信conf文件正在加载但我不明白为什么我仍然需要htaccess让我看到任何动作。

的.htaccess

#PassengerEnabled On
PassengerAppRoot /var/www/leoadmin/
#Options -MultiViews
#PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
#RackBaseURI /var/www/leoadmin

vhost config

<VirtualHost *>

    ServerName leoadmin

    DocumentRoot /var/www/leoadmin/public
    <Directory /var/www/leoadmin/public>
            Allow from all
    </Directory>
    Alias /leoadmin /var/www/leoadmin/public
    <Location /leoadmin>
            SetEnv RAILS_RELATIVE_URL_ROOT "/leoadmin"
            PassengerAppRoot /var/www/leoadmin
    </Location>

    ErrorLog /var/log/apache2/leoadmin-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/leoadmin-access.log combined

</VirtualHost>

1 个答案:

答案 0 :(得分:0)

我几乎没有任何痛苦和痛苦,试图在几个月前对它进行排序,我的配置允许我做子URI,所以我不确定这是否是你想要的,但它将沿着这些线。我从来没有为此设置提供.htaccess文件:

NameVirtualHost *:80 <VirtualHost *:80>
ServerName www.test.co.uk
DocumentRoot /web/rails
<Directory /web/rails>
    Allow from all
</Directory>

RailsBaseURI /test
RailsEnv development
<Directory /web/rails_projects/test/>
    Options -MultiViews
</Directory>

对我来说/web/rails是一个根目录,从那里我有一些符号链接到我存储项目的/home/目录。 ServerName是您将要识别的机器使用的任何限定名称。

(以防万一,我正在运行Passenger 3.0.9和Rails 3.2.11)