看到文档根而不是我的rails应用程序运行,Ubuntu VPS与Phusion Passenger

时间:2011-08-10 18:23:31

标签: ruby-on-rails apache passenger

我在我的VPS上运行ubuntu并安装了apache以及phusion乘客来部署我的rails应用程序。我经历了设置为phusion乘客,一切安装得很好。我编辑了apache配置文件并附加了下面的信息。我还确保Virtualhost没有被覆盖默认主机,当我更改并刷新浏览器时,我被带到了rails应用程序的公共目录,而不是执行rails应用程序。任何帮助将不胜感激。

添加到/etc/apache/apache2.conf

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.8
PassengerRuby /usr/bin/ruby1.8
PassengerDefaultUser www-data


<VirtualHost *:80>
            ServerName localhost
    DocumentRoot /home/bodylabel/globify/public
    <Directory /home/bodylabel/globify/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

的/ etc / apache2的/网站启用/ 000-默认

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

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

        CustomLog ${APACHE_LOG_DIR}/access.log combined
    # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

/etc/host.conf的

# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on

刚刚运行sudo乘客身份并取回以下内容:

*** Cleaning stale folder /tmp/passenger.44591
*** Cleaning stale folder /tmp/passenger.44300
*** Cleaning stale folder /tmp/passenger.44372
*** Cleaning stale folder /tmp/passenger.44200
*** Cleaning stale folder /tmp/passenger.21157
*** Cleaning stale folder /tmp/passenger.43944
*** Cleaning stale folder /tmp/passenger.21589
*** Cleaning stale folder /tmp/passenger.44878
ERROR: Phusion Passenger doesn't seem to be running.

2 个答案:

答案 0 :(得分:0)

强制性的愚蠢问题,但是,你重启了apache吗?

此外,虽然这可能不是您的问题的根源,但您可能希望使用debian-esque方法在此部署网站,并将该虚拟主机配置放入/etc/apache2/sites-available并运行a2ensite激活它。

对于模块可用和模块启用,可能存在类似的构造,您可以在其中放置乘客代码,而不是在apache2.conf中。

答案 1 :(得分:-1)

您有两个VirtualHost,其中包含IP /端口名称*:80。 Apache将在这里做两件事之一。 如果您的配置中有匹配的NameVirtualHost指令,那么它将在这两个虚拟主机部分中查找ServerName(和ServerAlias)指令,如果传入的请求与那些服务器名称/别名匹配,那么它将为该虚拟主机提供服务。

否则,它将提供配置文件中首先定义的第一个VirtualHost块。那么,提供哪一个将取决于相对于sites-enabled/000-default

VirtualHost部分的位置apache2.conf所包含的顺序